Can someone tell me why this isnt working? i am receiving a database not updated error, it should be showing the database updated, id, first name, last name, phone.
please thank you in advance..
// <?php
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$phone = $_POST['phone'];
mysql_connect ("localhost", "lddenter_xxx", "xxx") or die (' Error: ' .mysql_error());
mysql_select_db ("lddenter_test");
$query="INSERT INTO commentTable (ID, firstname, lastname, phone)
VALUES ('NULL','".$firstname."','".$lastname."','".phone."')";
mysql_query($query) or die ('Error Updating Database');
$result = mysql_query ($query);
echo('Database Updated With: ' . $firstname . ' ' .$lastname . ' ' . $phone);
?> //
the html
// <body>
<form id="form1" name="form1" method="post" action="test.php">
<p>First Name:<br >
<input name="firstname" type="text" id="firstname" />
<br >
<br > Last Name:<br >
<label>
<input type="text" name="lastname" id="lastname" >
</label>
<br ><br >
Phone Number:<br >
<label>
<input type="text" name="phone" id="phone">
</label>
<br ><br >
<label>
<input type="submit" name="Submit" id="Submit" value="Submit Customer Information" >
</label>
<br >
</form>
</body> //
please thank you in advance..
// <?php
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$phone = $_POST['phone'];
mysql_connect ("localhost", "lddenter_xxx", "xxx") or die (' Error: ' .mysql_error());
mysql_select_db ("lddenter_test");
$query="INSERT INTO commentTable (ID, firstname, lastname, phone)
VALUES ('NULL','".$firstname."','".$lastname."','".phone."')";
mysql_query($query) or die ('Error Updating Database');
$result = mysql_query ($query);
echo('Database Updated With: ' . $firstname . ' ' .$lastname . ' ' . $phone);
?> //
the html
// <body>
<form id="form1" name="form1" method="post" action="test.php">
<p>First Name:<br >
<input name="firstname" type="text" id="firstname" />
<br >
<br > Last Name:<br >
<label>
<input type="text" name="lastname" id="lastname" >
</label>
<br ><br >
Phone Number:<br >
<label>
<input type="text" name="phone" id="phone">
</label>
<br ><br >
<label>
<input type="submit" name="Submit" id="Submit" value="Submit Customer Information" >
</label>
<br >
</form>
</body> //
Last edited: