Jump to content

This may be easy to you lot, its drivin me MENTAL!


will_fluke

Recommended Posts

tell me how to add the correct values in the PHP file cause it's drivin me over the edge!

This shouldnt be to taxin.

<html>

<head>

 

 

<script type ="text/javascript">

 

function blanks()

{

form1.reset()

}

function validate()

{

 

<title>Audi Form Document</title>

 

Customer_ID = document.form1.Customer_ID.value

Title = document.form1.s1.options[form1.s1.selectedIndex].text

Forename = document.form1.Forename.value

Surname = document.form1.Surname.value

Address_1 = document.form1.Address_1.value

Address_2 = document.form1.Address_2.value

Postcode = document.form1.Postcode.value

Day = document.form1.s2.options[form1.s2.selectedIndex].text

Month = document.form1.s3.options[form1.s3.selectedIndex].text

Time = document.form1.s4.options[form1.s4.selectedIndex].text

 

if((Customer_ID_i=="")||(Forename=="")||(Surname=="")||(Address_1=="")||(Address_2=="")||(Postcode=="")||(Day=="")||(Month=="")||(Time==""))                         

{

alert("Missing Details")

 

}

else

{

 

alert(Customer_ID+"\n"+Title1+ " "+Forename.substring(0,1).toUpperCase()+""+Surname.toUpperCase()+"\nADDRESS: "+Address_1+"\n"+Address_2+"\n"+Postcode+"\n"+Day+"\nMONTH: "+Month+"\nTIME: "+Time)

 

 

</script>

</head>

<body>

<form name="form1" onSubmit="return validate()" action="AddBooking.php" method = "post">

 

 

  <b>Title</b>

<select title1="select"id="s1">

<option value="mr">Mr</option>

<option value="mrs">Mrs</option>

<option value="ms">Ms</option>

<option value="dr">Dr</option>

</select>

</br>

 

<b>Customer Number</b><input name="Customer_ID" type="text" id="Customer_ID"></br>

  <b>Forename</b><input name="Forename" type="text" id="Forename"></br>

  <b>Surname</b><input name="Surname" type="text" id="Surname"></br>

  <b>Street</b><input name="Address Line 1" type="text" id="Address_1"></br>

<b>Town</b> <input name="Address Line 2" type="text" id="Address_2"></br>

<b>Postcode</b><input name="Postcode" type="text" id="Postcode"></br>

 

 

Day of Drive

<select Day ="select"id="s2">

<option Value ="1">1st</option>

<option Value ="2">2nd</option>

<option Value ="3">3rd</option>

<option Value ="4">4</option>

<option Value ="5">5</option>

<option Value ="6">6</option>

<option Value ="7">7</option>

<option Value ="8">8</option>

<option Value ="9">9</option>

<option Value ="10">10</option>

<option Value ="11">11</option>

<option Value ="12">12</option>

<option Value ="13">13</option>

<option Value ="14">14</option>

<option Value ="15">15</option>

<option Value ="16">16</option>

<option Value ="17">17</option>

<option Value ="18">18</option>

<option Value ="19">19</option>

<option Value ="20">20</option>

<option Value ="21">21</option>

<option Value ="22">22</option>

<option Value ="23">23</option>

<option Value ="24">24</option>

<option Value ="25">25</option>

<option Value ="26">26</option>

<option Value ="27">27</option>

<option Value ="28">28</option>

<option Value ="29">29</option>

<option Value ="30">30</option>

<option Value ="31">31</option>

</select>

</br>

 

Month of Drive

<select Month ="select"id="s3">

 

<option Value ="January">Jan</option>

<option Value ="Febuary">Feb</option>

<option Value ="March">Mar</option>

<option Value ="April">Apr</option>

<option Value ="May">Mar</option>

<option Value ="June">Jun</option>

<option Value ="July">Jul</option>

<option Value ="August">Aug</option>

<option Value ="September">Sep</option>

<option Value ="October">Oct</option>

<option Value ="November">Nov</option>

<option Value ="December">Dec</option>

</select>

</br>

 

 

Time

 

<input name="Time" type="text" id="Time">

 

<center><input type="submit" name="submit" value="submit" onClick="validate()">

<input type="button" name="Button" value="Reset" onClick="blanks()"></center>

 

</form>

 

 

 

 

 

 

</body>

</html>

HELP HELP HELP

 

 

<html>

<head>

  <title>Audi Bookings</title>

</head>

<body>

<h1>Test Drive Bookings</h1>

 

<?php

 

  // create short variable name

  $Customer_ID=$HTTP_POST_VARS['Customer_ID'];

$Title=$HTTP_POST_VARS['s1'];

    $Forename=$HTTP_POST_VARS['Forename'];

  $Surname=$HTTP_POST_VARS['Surname'];

  $Address_1=$HTTP_POST_VARS['Address_1'];

    $Address_2=$HTTP_POST_VARS['Address_2'];

$Postcode=$HTTP_POST_VARS['Postcode'];

$Day=$HTTP_POST_VARS['s2'];

$Month=$HTTP_POST_VARS['s3'];

$Time=$HTTP_POST_VARS['Time'];

 

 

 

  @ $db = mysql_connect('mysql.bsccomputing.net', 'pc121', 'pc12107');

 

  if (!$db)

  {

    echo 'Error: Could not connect to database.  Please try again later.';

    exit;

  }

  else

  {

  mysql_select_db('pc121');

  $query = "insert into Booking(Customer_ID,Title,Forename,Surname,Address_1,Address_2,Postcode,Day,Month,Time) values   ('$Customer_ID','$Title','$Forename','$Surname','$Address_1','$Address_2','$Postcode','$Day','$Month','$Time')";

  $result = mysql_query($query);

  if ($result)

  echo 'Test Drive inserted';

  else

  echo 'Did not work';

  }

?>

<p>Click <a href="AudiFORM1.html">here</a> to return to the login page</font></p>

</body>

</html>

 

THE PHP FILE

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.