Jump to content


Posting a Dynamic Text Field *RESOLVED*

  • Please log in to reply
3 replies to this topic

#1 pikemsu28

  • Members
  • PipPipPip
  • Advanced Member
  • 164 posts

Posted 14 September 2006 - 08:17 PM

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?

#2 ultrus

  • Members
  • PipPipPip
  • Advanced Member
  • 244 posts

Posted 14 September 2006 - 11:22 PM

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!  :)
Twitter | Blog | Worlds to explore. Worlds to create.

#3 JustinK101

  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego, California, US

Posted 15 September 2006 - 04:19 AM

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.

#4 pikemsu28

  • Members
  • PipPipPip
  • Advanced Member
  • 164 posts

Posted 19 September 2006 - 02:13 PM

Thanks Justin, I needed the hidden form variable to post the changes.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users