Submit button on form

I am not a complete noobie when it comes to creating and editing pages but I am far from an expert!

I have a form that I copied and repurposed. It is an outlook at where airplanes will be over the next few months.
It has a rolling date - IE: every day at midnight, a new day is added to the bottom of the form. The code looks like this:

@import "miniops.css";

Switch to: Charters Display

- Make Any Changes and Press Submit at The Bottom When Finished -

<?php $username="******"; $password="******"; $script_database="******"; //**************Define Today and each day following************// $today = date("Y,m,d"); $today2=explode(',',$today); $rolling_date[] = new DateTime(); $rolling_date[0]->setDate(2010,10,10); //TODAY $rolling_date2[] = $rolling_date[0]->setDate($today2[0],$today2[1],$today2[2]); //TODAY $d=1; $dd=0; while ($d < 90) { $rolling_date[$d] = new DateTime(); $rolling_date[$d]->setDate($today2[0],$today2[1],$today2[2]); $rolling_date[$d]->modify("+$d day"); $rolling_date2[$d] = $rolling_date[$dd]->format("D M j"); echo ""; mysql_connect(localhost,$username,$password) or die("No date selected"); @mysql_select_db($script_database) or die("No date selected"); $query="SELECT * FROM forecast WHERE date = '{$rolling_date2[$d]}' ORDER BY id DESC LIMIT 1"; $result=mysql_query($query); $numd=mysql_numrows($result); mysql_close(); if ($numd == 1) { $m=0; $id=mysql_result($result,$m,"id"); $date=mysql_result($result,$m,"date"); $gaat=mysql_result($result,$m,"gaat"); $glho=mysql_result($result,$m,"glho"); $feva=mysql_result($result,$m,"feva"); $confirmed=mysql_result($result,$m,"confirmed"); $tentative=mysql_result($result,$m,"tentative"); $notes=mysql_result($result,$m,"notes"); } echo " "; $d++; $dd++; echo ""; unset($id); unset($date); unset($gaat); unset($glho); unset($feva); unset($confirmed); unset($tentative); unset($notes); unset($numd); unset($result); unset($query); } ?>
AIRCRAFT INFORMATION CURRENT OPERATIONS
Date C-GAAT C-GLHO C-FEVA Charter Charter
Crew Avail
Notes
$rolling_date2[$d]

Warning: Pressing Submit Sends an Email to the Admins

It works great except one thing. I want a single submit button at the bottom of the form to save the data and display it in the table. I can set it up to work with pressing submit at the end of each row but I have not been successful with a single button. The script looks like this:

<?php $id=$_POST['id']; $date=$_POST['date']; $gaat=$_POST['gaat']; $glho=$_POST['glho']; $feva=$_POST['feva']; $confirmed=$_POST['confirmed']; $tentative=$_POST['tentative']; $notes=$_POST['notes']; $username="******"; $password="******"; $database="******"; mysql_connect(localhost,$username,$password) or die("Unable to connect to database"); @mysql_select_db($database) or die("Unable to select database"); if ($id == "") { $sqlquery = "INSERT INTO forecast (date,gaat,glho,feva,confirmed,tentative,notes) VALUES('$date','$gaat','$glho','$feva','$confirmed','$tentative','$notes')"; } else { $sqlquery = "UPDATE forecast SET date='$date',gaat='$gaat',glho='$glho',feva='$feva',confirmed='$confirmed',tentative='$tentative',notes='$notes' WHERE id ='$id' LIMIT 90"; } $results = mysql_query($sqlquery); mysql_close(); ***(Send mail script follows - currently turned off for editing)*** ; ?>

Does this make sense? Can anyone see where I’m going wrong? I need to have the rolling date thing but then have the ability to submit/display the entire contents of the table with one button (which also notifies certain people via email that the form has been updated).

Thank you in advance for any replies… it has me going around the building like this: :’( especially when people call me away from the script for mundane random IT stuff.

Update: It saves the last day/row of the table when set to one button. The only real change between getting multiple buttons and one is I move the line:

echo "

";

below the unsets.

Sponsor our Newsletter | Privacy Policy | Terms of Service