Reply to Re: Form Has Memory

Your name:

Reply:


Posted by Terry on 05/27/06 15:01

battle.chris@gmail.com wrote:
> Hello.
>
> 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.
>
> Any ideas?
>

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());
$row=mysql_fetch_array($result,MYSQL_NUM);
$num=mysql_num_rows($result);
$row[4]=htmlspecialchars($row[4], ENT_QUOTES);

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\"
value=\"$row[4]\">

<input type=\"hidden\" name=\"oldid\" value=\"$id\">
That allows (with an if statement) the record to be modified.

HTH
--
TK
http://www.wejuggle2.com/
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 =----

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация