Jump to content

edit and update button on the same form in php


jackgoddy123
Go to solution Solved by mac_gyver,

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.