For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > October 2007 > basic form entry









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author basic form entry
sm

2007-10-07, 4:00 am

I have been racking my brains trying to figure out what I am doing wrong. i
have created a basic form that calls requests user information...the form
then runs insert.php. No errors are returned, however, my database does not
update. Any suggestions? thanks

The field names in the table are correct (case).


SUBMIT.HTML:

<form action="insert.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
Phone: <input type="text" name="phone"><br>
Mobile: <input type="text" name="mobile"><br>
E-mail: <input type="text" name="email"><br>
Web: <input type="text" name="web"><br>

<input type="Submit" value="click para enviar">

</form>


INSERT.PHP

<? php
echo"hello"
$username = "guest";
$psswd = "password";
$db = "contacts";
$host = "localhost";

$first_name = $_POST['first'];
$last = $_POST['last'];
$phone = $_POST['phone'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$web = $_POST['web'];

mysql_connect($host,$username,$psswd) or die ("errror in access db");
mysql_select_db($db);




mysql_query ("INSERT INTO users (First,Last,Phone,Mobile,Email,Web) VALUES
('$first_name','$last','$phone,'$mobile'
,'$email','$web') ");

echo('$username','$last')

echo mysql_error(mysql_connect($host,$usernam
e,$psswd));

?>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com