View Full Version : PhP form
evilping
06-06-2008, 12:25 PM
Hi guys,
i need some advice, am making a form and i want one field to be able to browse some data through MySQL,
Any idea how i can do that, am very new to php and sql.
Regards
boogyman
06-06-2008, 02:40 PM
http://www.php-mysql-tutorial.com/
allahverdi
06-09-2008, 06:25 PM
boogyman says true open that link, very useful.
but lemme say it ^^:
1. HTML:
<form method="POST">
Name: <input name="myname" type="text" /><br/>
Lastame: <input name="mylastname" type="text" /><br/>
Homepage: <input name="mypage" type="text" /><br/>
<input type="submit" name="submit">
</form>
2. PHP:
<?php
include("dbconnect.php"); //Your db config...
if(isset($_POST['submit'])){ //When you press submit button
$name = $_POST['myname']; //Myname text value
$lastname = $_POST['mylastname']; //Lastname text value
$homepage = $_POST['mypage']; // Homepage text value
$result = mysql_query("INSERT INTO info(name, lastname, homepage) VALUES('$name', '$lastname', '$homepage')"); //inserts into table, you need to have table named info, and coloumns, name, lastname, homepage
}
?>
This was for inserting into table...
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.