faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

29 of 50 people (58%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

how do i update mysql db with form variables using php?

Mar 20th, 2008 16:58
ha mo, Jakub Vrana, Tasneem Rangoonwala,


If you have this form:
<form method="post">
<input name="surname">
<input type="submit">
</form>
You can run this PHP code:
<?php
mysql_connect("localhost", "login", "password");
mysql_select_db("your_db");
mysql_query("UPDATE people SET surname = '$_POST[surname]'");
?>
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.templatestemp.com