Hi experts,
I have a form with many textboxes,listb oxes in php.I have a edit button to edit the values in the form.once i click the edit button the existing values should be displayed so that the user can edit those particular values and also that should be updated in the mysql database.kindly reply me as early as possible.
Thanks
8 2169 TheServant 1,168
Recognized Expert Top Contributor
So when the user clicks edit do you want the page to reload or to just display/enable the text boxes? If you reload you need to send the form to itself (via the action attribute) and check if the method of the page load is "post" and if so, you can have different options with the form via using PHP.
If you don't want the page to load, you need to use javascript to change the form inputs properties and show the "submit" button.
I am not going to write the code for you as the purpose of these forums is not to work for nothing, but help those with some code they already have. Try and get this script working and if you get stuck come back and we'll be happy to help.
PS - How much do you know about PHP and/or MySQL?
Markus 6,050
Recognized Expert Expert
I don't see a question in that post. Please revise your post to include a question and sufficient details of your problem. Also, you should post the code you have attempted to solved your problem with - we do not hand out code.
Moderator.
hi experts,
I have attached the code for the form and the database connection.
I want the code to edit the existing values in the form and to store the edited values in the database.
res.html
res.php -
<?php
-
-
$con=mysql_connect("localhost","root","");
-
if(!con)
-
{
-
die("cannot connect".mysql_error());
-
}
-
-
-
mysql_select_db("resume_db",$con);
-
-
-
mysql_query("insert into res_table
-
-
(uname,email,qualification,mobile,percentage,location,institute,country,others,address,jobcategory,joblocation,experience,salary,keyskills,resumetitle,employer)
-
-
values
-
-
('$_POST[uname]','$_POST[email]','$_POST[qualification]','$_POST[mobile]','$_POST[percentage]','$_POST[location]','$_POST[institute]','$_POST[country]','$_POST[others]','$_POST[address]','$_POST[jobcategory]','$_POST[joblocation]','$_POST[experience]','$_POST[salary]','$_POST[keyskills]','$_POST[resumetitle]','$_POST[employer]')") or die(mysql_error());
-
-
$result = mysql_query("SELECT * FROM res_table");
-
-
-
echo "<h3>"."You have successfully uploaded your resume"."</h3>."."<br/>";
-
-
echo "<h4>"."The contents uploaded in your resume are as follows"."<h4>";
-
-
-
-
while($row = mysql_fetch_array($result))
-
{
-
-
echo "<table align='left' cellspacing='8' cellpadding='20'>";
-
-
-
-
echo "<tr>"."<td>"."<b>"."Email:"." "." ".$row['email']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Mobile:"." "." ".$row['mobile']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Location:"." "." ".$row['location']."</td>"."</tr>";
-
echo "<tr>"."<td>". "<b>"."Country:"." "." ".$row['country']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Address:"." "." ".$row['address']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Qualification:"." "." ".$row['qualification']."</td>"."<tr>";
-
echo "<tr>"."<td>"."<b>"."Percentage:"." "." ".$row['percentage']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Institute:"." "." ".$row['institute']."</td>"."</tr>";
-
-
-
echo "</table>";
-
-
-
echo "<table align='center' cellspacing='8' cellpadding='20'>";
-
-
-
-
echo "<tr>"."<td>"."<b>"."Job Category:"." "." ".$row['jobcategory'] ."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Job Location:"." "." ".$row['joblocation']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Experience:"." "." ".$row['experience']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Salary:"." "." ".$row['salary']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."KeySkills:"." "." ".$row['keyskills']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Resume Title:"." "." ".$row['resumtitle']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Employer:"." "." ".$row['employer']."</td>"."</tr>";
-
echo "<tr>"."<td>"."<b>"."Others:"." "." ".$row['others']."</td>"."</tr>";
-
-
-
echo "</table>";
-
-
-
-
}
-
-
-
-
?>
kindly somebody help me out on this code.urgent.
Thanks
The code display on this site is not wide enough in my opinion.
What exactly are you trying to achieve? I assume its an basic insert of a record, then pulling it out again and displaying it?
When you insert the data you could then get the last ID entered with mysql_insert_id () then you can pull it out again I guess something like: - mysql_query(".. insert all the data here ..");
-
$some_id = mysql_insert_id();
-
$display_q = mysql_query(" select foo from bar where some_id = '$some_id' ");
-
$row = mysql_fetch_array($display_q);
Then display the data as need be. It seems like you are trying to pull everything again and display it.
Can you advise what the actual problem is.
Thanks.
Thanks for u r reply hoopy,
I m a beginner to php.so the code will not be that much wide enough.any way i m developing a small demo application like a jobsite for my project.
created a login page,profile page and the post resume page to input the details of the candidates.here i have 2 buttons one to post resume and the other is to edit resume .
if we click the edit resume button the existing values of the user should be populated in the inputboxes and listboxes and the user is allowed to edit those values and once the edit resume button is clicked the values gets updated in the database and displayed again.
Able to catch atleast to some extent.pls try to help me out on this.need a sample code for this.
Thanks
I dont know how you have your DB setup and I have dont have a lot of time right now but if you can follow this then you can see quite simply how it works. Say your DB Is laid out like this: - --
-
-- Database: `job_db`
-
--
-
-
CREATE TABLE `resumes` (
-
`user_id` int(10) unsigned NOT NULL auto_increment,
-
`full_name` varchar(100) NOT NULL,
-
`salary` varchar(100) NOT NULL,
-
`joined` int(11) NOT NULL,
-
PRIMARY KEY (`user_id`)
-
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
Say you had this basic example as your form: - <form action="display.php" method="post">
-
Full Name: <input type="text" name="full_name"> <br />
-
Salary: <input type="text" name="salary"> <br />
-
<input type="submit" name="submit" value="Insert">
-
</form>
Then display.php would be like this: - <?
-
-
// db connection
-
mysql_connect("localhost", "root", "")
-
or die(mysql_error());
-
mysql_select_db("job_db")
-
or die(mysql_error());
-
-
// sanitise user input
-
$full_name = mysql_real_escape_string($_POST['full_name']);
-
$salary = mysql_real_escape_string($_POST['salary']);
-
$time = time();
-
-
// insert the data
-
mysql_query("
-
INSERT INTO resumes
-
(full_name, salary, joined)
-
VALUES
-
('$full_name', '$salary', $time)
-
") or die(mysql_error());
-
-
// retrieve the last id inserted
-
$user_id = mysql_insert_id();
-
-
// pull it back out
-
$query = mysql_query("
-
SELECT full_name, salary, joined
-
FROM resumes
-
WHERE user_id = '$user_id'
-
") or die(mysql_error());
-
-
// store the row
-
$row = mysql_fetch_array($query);
-
-
// display the output
-
echo ("Name: " . $row['full_name'] . "<br />");
-
echo ("Salary: " . $row['salary'] . "<br />");
-
echo ("Joined: " . strftime("%H:%M %d/%m/%y", $row['joined']));
-
-
?>
I have tried to keep it as simple as possible. So if you went to that form, and entered those variables it would sanitise the input. Input the data into the table then retrieve the ID which was just inserted, pull it out again and display it.
So it may look something like: - Name: Hoopy
-
Salary: 100
-
Joined: 17:40 26/02/09
If you follow this principle with your code then you should be OK. mysql_insert_id is what you need to look into and the ID it will return is determined by how your database table is setup.
Also the comment about the width was not about your code, it was about the width which Bytes makes the code display, its always a bit too narrow imo.
Hope this help. Good Luck.
hi hoopy,
Good After noon,
thanks for u r code.i will check out and revert back to u.
Thanks
Markus 6,050
Recognized Expert Expert
Please keep off-topic discussion outside of this thread please.
Thank you.
- Markus.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nomen Nescio |
last post by:
can anyone be so kind as to look at
http://www.mysolution.ws/HYPOCRITE.php
and let me know why it isn't passing the form data to
http://www.mysolution.ws/insertHYPOCRITES.php
for the most part, the scripts were created with
http://phpcodegenie.sourceforge.net/
|
by: Dan Weeb |
last post by:
Hi All,
I have struggled through this far with help from many of you so thanks. I am
stuck again. I am really new to this so don't be harsh :-)
There are a few problems. You can run the script here
http://www.pbrown.com/research/test1.php to see the formatting issues
Formatting Issues
|
by: Bob Kaku |
last post by:
I'm trying to create a text editing and updating capability to help
someone who wants to maintain content on a web page without having to
know any HTML or use a web authoring tool and FTP'ng the contents.
I've already created a screen whereby the person can create new
content with a PHP program that inserts into a MySQL table. But, I'm
having a little trouble in creating the edit/update functionality.
Can somebody help me out? Thanks.
...
|
by: webhigh |
last post by:
I¹m not sure if this a PHP question or an MySQL question but here it goes.
I have a repeat region of a table called userid
What I¹m trying to accomplish is being able to edit the record and then
update it by clicking a submit button on the same line. I¹m doing it this
way so the user can quickly update a number of records one at a time. I know
I could do this by passing the userid info to a detail page but really want
to do it the way...
|
by: Sebi |
last post by:
Hello All,
I'm having problems, reading the new Values from CheckBox
in a DataGrid.
my Code Behind is C#
I do exactly what other samples do, but I allways get the
Initial Values instead of the current values choosen by
the user!!
| |
by: assgar |
last post by:
Hi
Developemnt on win2003 server. Final server will be linux
Apache,Mysql and PHP is being used.
I use 2 scripts(form and process).
The form displays multiple dynamic rows with chechboxs, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply.
Each dynamically created row will return 3 values fee1_choice, fee1_unit and fee1_money.
Note The above informaton is...
|
by: dongletran06 |
last post by:
Hi,
Please help me find out what wrong with my codes in inputting from my form to mysql database using drop down menu. Below is the codes I used. Only the drop down is not working but the "input text" are successfully adding data to mysql. I just try first using the month as drop down. The month data type I used in mysql database is varchar. Im new in PHP please help me. Thanks
<?php /* Created on: 10/12/2006 */ ?>
<html>
<body>
<?php...
|
by: adamace5o |
last post by:
When i try to use post variables with php and mysql i can't get the insert into statement to accept varibles as values. If i use 'test' instead of $test it does work. I suspect it is something to do with the javascript im using but i can print the correct values so why am i unable to use them to enter data to a database? sorry i am new to all this
here is the updatedata.php file
<?php
session_start();
$host="localhost"; // Host...
|
by: liberty1 |
last post by:
Hi everyone. I appreciate your effort at helping newbies like me. I have the following problems and will appreciate urgent help.
PROBLEM NUMBER 1:
Using PHP and MySQL, I am able to upload picture successfully unto the server but not so with the file name of the picture even though other parameters in my form got inserted successfuly in the database. I have read several posts on this topic including here on this site but I can't get around...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |