Hi experts,
I have a form with many textboxes,listboxes 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 2151
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?
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
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |