Jump to content


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


Posting a Dynamic Text Field *RESOLVED*

Recommended Posts

Sorry if this is basic, i'm very new to php and mysql.  I have a form that will be used to update registration information the user entered when registering for access to my site.  I have the information displaying using <?php echo $row_table['value'];?> in the text field.  how would i then update the form if the person changes the information and clicks the post button?

Share this post

Link to post
Share on other sites
I'm not sure how to answer your question as I am a bit of a newb myself. I think you will need to "update" the info in the database before retreiving and showing the info in the form? Or perhaps do an if statement if you don't want to post it to the database just yet like this:

if($_POST['value']) { echo $_POST['value']; } else { echo $row_table['value']; }

For mysql examples, I always find this site to be a good reference:

Hope this helps inspire something!  :)

Share this post

Link to post
Share on other sites
By update the form I assume you mean UPDATE in the database? I will explain the generals, though there is more to get it working.

1.) Assign a hidden value into the form.
<input type="hidden" name="isSubmitted" value="true">

This allows you to tell if a user has clicked submit on the form.

2.) Check the value of $_GET['isSubmitted'] assuming your form method is GET.

  //Preform The MySQL Update
  $sql = "UPDATE table SET value = '" . $_GET['value'] . "' WHERE someclause LIMIT 1";
  mysql_query($sql) || die(mysql_error());

Again there is more to this, but this should get your started.

Share this post

Link to post
Share on other sites


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.