rogerzebra
Technical User
Hi again
I added to my submission form some required fields which has to be filled in otherwise it doesn't execute the form. After I added this feature something went wrong or missing, what have I done wrong or what's missing?
As usual I appreciate all help or tips that pointing me in a direction to take me forward.
Thanks in advance.
/rz
I added to my submission form some required fields which has to be filled in otherwise it doesn't execute the form. After I added this feature something went wrong or missing, what have I done wrong or what's missing?
Code:
<?php
// connect to server, database, table.
include 'db_intranet.php';
$class_code = ($_POST['class_code']);
$date_recieved = ($_POST['date_recieved']);
$producer = ($_POST['producer']);
$name_insured = ($_POST['name_insured']);
$effective_date = ($_POST['effective_date']);
$primary_state = ($_POST['primary_state']);
/*stripslashes to make sure that's not any escaped characters */
$class_code = stripslashes($class_code);
$date_recieved = stripslashes($date_recieved);
$producer = stripslashes($producer);
$name_insured = stripslashes($name_insured);
$effective_date = stripslashes($effective_date);
$primary_state = stripslashes($primary_state);
/* required information */
if((!$date_recieved) || (!$producer) || ($name_insured)){
echo 'You did not submit the following required information! <br />';
if(!$date_recieved){
echo "Date recieved is a required field. Please enter it below.<br />";
}
{
echo 'You did not submit the following required information! <br />';
if(!$producer){
echo "Producer is a required field. Please enter it below.<br />";
}
{
echo 'You did not submit the following required information! <br />';
if(!$name_insured){
echo "Name insured is a required field. Please enter it below.<br />";
}
include 'submission_form.html';
exit();
}
// insert information into the database
$query="INSERT INTO submissions (class_code, date_recieved, producer,
name_insured, effective_date, primary_state)
VALUES ('$_POST[class_code]','$_POST[date_recieved]','$_POST[producer]',
'$_POST[name_insured]','$_POST[effective_date]','$_POST[primary_state]')";
if(!mysql_db_query($database_name,$query)) die(mysql_error());
echo "success in database entry.";
echo "<br />";
echo "<a href=\"submission_form.html\">Click here to return to the form page.</a>";
?>
As usual I appreciate all help or tips that pointing me in a direction to take me forward.
Thanks in advance.
/rz