Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Form Has Memory
May 25, 2006, 2:30 am
rate this thread
I'm trying to fill form fields with values from a mysql record using
php. The problem is that when I move to a new record, the form still
displays the old data! The html source is updated but the previous
record is still displayed even after hitting refresh. Running the code
in a new window shows the correct result until I move to a new record.
Re: Form Has Memory
I have a form built to insert/modify/delete records. If you do not
enter an id number, you insert a new record. If you enter an id you get
the record inserted in the form values ready to modify. When you submit
it checks that the New id == Old id and if yes modifies the record.
This form is for one user only - the only security is obscurity.
$query="SELECT * FROM `clyde` WHERE id=$id";
$result=mysql_query($query) or die('Query 1 failed: ' . mysql_error());
This is the <form> which posts then comes back with the changed data.
When you enter a new id, submit, you get the new record ready to change.
<label>Sizes </label><input type=\"text\" id=\"sizes\" name=\"sizes\"
<input type=\"hidden\" name=\"oldid\" value=\"$id\">
That allows (with an if statement) the record to be modified.
Still Having a Ball
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
- » How do you do selected in a multi-value list box in a form?
- — Previous thread in » PHP Scripting Forum