View Single Post
Old 09-26-2011, 09:21 PM  
potter
Confirmed User
 
Industry Role:
Join Date: Dec 2004
Location: Denver
Posts: 6,559
You guys really saying you'd ask for money for 7 lines of (very common) code? Sheesh!

form.php
Code:
<form name="input" action="script.php" method="post">
Username: <input type="text" name="user" />
Email: <input type="text" name="email" />
<input type="submit" value="Submit" />
</form>
script.php
Code:
<?php

$dbconnect = mysql_connect('localhost', 'user', 'password') or die("Unable to connect to MySQL");
$database = mysql_select_db('database_name', $dbconnect) or die("Could not select database");

$user = mysql_escape_string($_POST['user']);
$email = mysql_escape_string($_POST['email']);

mysql_query("INSERT INTO table_name VALUES ($user, $email)");

header("form.php");

exit;

?>
__________________

potter is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote