hi all.
I am trying to write a set of scripts that will produce the following result.
User is presented with an input form.
User completes the the input form and clicks on next button.
User is presented with page that details the input.
User clicks on save button and the record is written to the database.
Because the forms are long I will only use one field as an example of what I have so far.
INPUT FORM
<form action="international_intelligence_courses_provisional_booking_complete.php" method="post" name="form2" id="form2">
<input name="company_name" type="text" class="courseinfo" value="" size="50" />
<input name="submit" type="submit" value="Book Now" />
<input type="hidden" name="MM_insert" value="form2" />
</form>
INPUT REVIEW PAGE
<form action="insert_record.php" method="post" name="book_course_form" id="book_course_form">
<?=$_POST["company_name"];?>
<input type="hidden" name="MM_insert" value="book_course_form" />
</form>
INSERT RECORD PAGE
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "book_course_form")) {
$insertSQL = sprintf("INSERT INTO int_course_booking (company_name) VALUES ( %s)",
GetSQLValueString($_POST['company_name'], "text"));
mysql_select_db($database_int_courses, $int_courses);
$Result1 = mysql_query($insertSQL, $int_courses) or die(mysql_error());
$insertGoTo = "international_intelligence_courses_provisional_booking_complete2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
<form action="<?php echo $editFormAction; ?>" method="post" name="book_course_form" id="book_course_form">
<input name="company_name" type="text" id="company_name" value="<?=$_POST["company_name"];?>" size="50" />
<input type="hidden" name="MM_insert" value="book_course_form" />
</form>
I think my question is, am I does this correctly or should I approach this in a different way.
Any advice or help would be good.