I am testing a larger form with a smaller form. Basically, very simple, submit form to page below, and this page should insert the record to the mysql database.
However, I get nothing: no errors, nothing.I do know that register globals are off, is that the issue?
I want to do it this way, because I want to assign two of the form fields to one variable, then record that in the database, as indicated below.
This is the insert page (not the complete html code, such as header details, but complete php code. etc...)
<?
$db_name = "name"
$dbserver = "servername";
$dbuser = "username";
$dbpass = "password";
$connection = mysql_pconnect($dbserver, $dbuser, $dbpass)
or die("Couldn't connect.");
if (!$connection)
{
echo "Error: Could not connect to database.";
exit
}
$db = mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$sname = $POST ['sname'];
$semail = $POST['semail'];
$date_filled = $_POST['date_filled'];
(eventually want to have here as this line:
$hours= $_POST['hoursam'] . $_ ['hourspm'];
or whatever the right format would be...)
$query = mysql_query("INSERT INTO student (semail, sname, date_filled) VALUES ('$sname', '$semail', '$date_filled')") or die (mysql_error());
?>
<html header here>
<body>
<?
echo $semail;
echo $sname;
echo mysql_affected_rows()." record inserted into database.";
?>
</body>
</html>
As I said, nothing gets submitted.
Thanks for helping a newbie!-