Jump to content

edit and update button on the same form in php


jackgoddy123

Recommended Posts

Hie,

    I am quite stuck up with my application. All i want to do is select member id and click on edit button. As soon as the button is clicked then the form textbox space must be filled with that selected member id. Then after making the changes the form should updated by at the last by clicking the updatet button.

 

Below is the code which i tried as far:

 

My index.php page:

<?php
mysql_connect('localhost', 'root', '') or die(mysql_error());
echo "Tick <p>";
mysql_select_db("test") or die(mysql_error());
echo "Tick"; 

$id = $_GET['id'];

$query = mysql_query("SELECT * FROM records WHERE id = '$id'")
or die(mysql_error());  

while($row = mysql_fetch_array($query)) {
echo "";

$name = $row['name'];
$email = $row['email'];
$contact = $row['contact'];
$requirement = $row['requirement'];


};

?>

<form action="update.php?id=<?php echo "$id" ?>" method="post">

<!--Name: <input type="text" name="name" value= value='".$row['name']."'><br>-->
name:<?php echo"<input name=\"name\" type=\"text\" id=\"name\" value=\"" .$name. "\">"; ?>
Email: <input type="text" name="email" value="<?php echo "$email" ?>"><br>

Contact: <input type="text" name="contact" value="<?php echo "$contact" ?>"><br>

Requirement: <input type="text" name="requirement" value="<?php echo "$requirement" ?>"><br>

<input type="Submit">
</form>

All i want is to load data in the form textbox automatically by clicking on edit button.

Please some one could help me out to solve my problem. Dont know what am i missing.

Any help is appreciated.

Thanks in advance.

since you didn't state what sort of problem you are having or where you are stuck at in doing this, we cannot help since we don't have a clue what you need help on, i.e we are not standing right next to you and you must communicate effectively to get help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.