Jump to content

deansaddigh

Members
  • Posts

    440
  • Joined

  • Last visited

    Never

Everything posted by deansaddigh

  1. Lol oopsy i tried going to http://localhost/index.html and i get a page not found error
  2. Hi guys, all i am trying to do is re-write my php pages to look like html pages. i found this code on the internet Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)\.htm$ $1.php [nc] i have enabled mod rewrite on my apache server. and saved the .htaccess file in the route of my site. It does absolutley nothing and my http://localhost/index.php stay as http://localhost/index.php ive attached an image to show that my .htaccess file is saved in route [attachment deleted by admin]
  3. thanks very much for your help, greatly appreciated
  4. Hi guys, basically im making an upload form for user avatars. I am adding the avatar details to the user table. my php code doesnt do anything and im not really sure why. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="icon" type="image/gif" href="../site icon/animated_favicon1.gif"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Lifey/Home</title> <!-- Css style sheet with form part 1--> <link href="../css/layout.css" rel="stylesheet" type="text/css" /> <?php /********************Db connection***********************************/ include '../db/connection.php'; ?> </head> <body> <!--top links --> <?php include "../includes/homepage_top_nav.php"; ?> <!-- Container div--> <div id="container"> <!-- puffin image--> <div id="puffin_image"></div> <!-- absolute positioned time and date--> <div id="dt"> <?php echo date("l, F dS Y g:i:s a ") ?> </div> <!-- Logo --> <div id="logo"></div> <!--contents--> <div id="contents"> <form method="post" enctype="multipart/form-data"> <p> Please use this form to upload your avatar</p> <fieldset class="login"> <legend>Avatar Upload</legend> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> <input name="userfile" type="file" id="userfile"> </fieldset> </form> <?php if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } include 'library/config.php'; include 'library/opendb.php'; $query = "INSERT INTO upload (name, size, type, content ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error, query failed'); include 'library/closedb.php'; echo "<br>File $fileName uploaded<br>"; } ?> </div> <?php include"../includes/homepage_footer_links.php"; ?> <!-- End Container div--> </div> </body> </html> Any one have any ideas its prob really simple but i cant for the life of me figure it out. Also can anyone say if this is the best way to do this, as i got this code from a website
  5. Thank you so much like i said i am new to php
  6. Hi i am new to php and am having problems with creating sessions. My login works but when i include session code at the top of the page it will not let the user go to the required page in this case it is studenthome.php. I think that it is not populating the php session variable. Logincheck.php <?php //Use the connect script to connect to CIS School database require "connectstudent.php"; //Use the student data to connect to the database $dbuser = $_GET["user"]; $dbpass = $_GET["password"]; $dbhost = 'localhost'; $dbname = 'CISSchool'; //Build the query checking the username and passowrd entered is correct $query = "select * from student where StudentUsername ='".$dbuser."' and StudentPassword = '".$dbpass."'" ; $result = mysql_query($query, $conn) or die ("Unable to perform query. <br/> $query <br/>" . mysql_error()); //Retrieve the data that is stored in the array $row= mysql_fetch_array($result); //If there is a match then take them to the student page if ($row != null) { $_SESSION["user"] = $row['StudentUsername']; header("Location: studenthome.php"); exit(); } //Else display error message and navigate to homepage else { //Pass this message to the index screen to let the user know they have incorrect login details $message = 'Invalid user name or password, please try again'; header("Location: index.php? message=$message"); exit(); } ?> studenthome.php <?php session_start(); if (isset($_SESSION['user']) == false) { header("Location:index.php"); exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="cis.css" rel="stylesheet" type="text/css" media="screen" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>cisukschool.co.uk: Great value learning</title> </head> <!--Open body--> <body> <!--Open container--> <div id="container"> <!--Open header--> <div id="topheader"> <?php $_SESSION['user'];?> <!--Open form, used to logout student--> <div id="formlogin"> <!--Form code--> <form name="logout" id="logout" method="post" action="logout.php"> <label> <input type="submit" name="submit" value="Log out" tabindex="1" class="submitbutton" /> </label> <!--Close form code--> </form> <!--Close form--> </div> <!--Close header--> -</div> <!--Open logo--> <div id="logo"> <!--Close logo--> </div> <!--Open left column--> <div id="leftcolumn"> <h1> Welcome</h1> <h1> Info</h1> <!--Close left column--> </div> <!--Open right column--> <div id="rightcolumn"> <!--Close right column--> </div> <!--Open footer--> <div id="footer"> <p align="center"> CIS School of English STUDENT</p> <!--Close footer--> </div> <!--Close the container--> </div> <!--Close body--> </body> </html> Thanks in advance
  7. First off can i please show you my code for adding data to db. I have done it to the best of my ability but i am wondering what happens if some parts of the sql fail. and some parts dont, then ill have incomplete data in the table. i have this code after each sql statement. //Execute sql statement 1 if (!mysql_query($student_details,$conn)) { die('Error: ' . mysql_error()); } But at the moment i have 4 of them, for the indivdual form parts. so my question is what happens if one of them fail but the others go through ok? How can i ensure each sql statement gets entered into the db? and if it doesnt how can i undo the previous insert statement??? I hope thats clear but i am terrible at explaining what i mean. The other thing i wanted to know was i have linker tables for example. i have a table called Payment_Student. all thats in the above table is student id and payment id. But i have know idea how i write the student id and payment id to it as the student id is auto incremented in the student table and like wise the payment id is auto incremented in the payment table, how do i had these into the payment_student table. Any help would be gratefully appreciated. I have also included my page so you can see what i have done so far. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include("includes/ico.html"); ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <?php include("db/connection.php"); //Connection string for db?> <link rel="stylesheet" href="css/layout.css" type="text/css" media="screen" /> </head> <body> <div id="container"> <div id="header"> </div> <div id="sidebar"> <div id="menu9"><?php include("includes/menu/menu.html"); ?></div> </div> <div id="content"> <div align="center"> <?php // Variable for Student details part of form $title=mysql_real_escape_string($_POST['title']); $First_name=mysql_real_escape_string($_POST['First_name']); $username=mysql_real_escape_string($_POST['username']); $Second_name=mysql_real_escape_string($_POST['Second_name']); $password=mysql_real_escape_string($_POST['password']); $DOB=mysql_real_escape_string($_POST['DOB']); $Nationality=mysql_real_escape_string($_POST['Nationality']); $Tel=mysql_real_escape_string($_POST['Tel']); $emergency_tel=mysql_real_escape_string($_POST['emergency_tel']); $email=mysql_real_escape_string($_POST['email']); $address=mysql_real_escape_string($_POST['address']); $Proffesion=mysql_real_escape_string($_POST['Proffesion']); $faxnumber=mysql_real_escape_string($_POST['faxnumber']); $number_years=mysql_real_escape_string($_POST['years_of_study']); $smoke=mysql_real_escape_string($_POST['Smoke']); $Special_requirements=mysql_real_escape_string($_POST['Special_requirements']); // End of Variables for Student details // Sql Query sends all data from the form into the student table $student_details="INSERT INTO Student (Title, First_Name,Username,Surname,Password,Dob,Nationality,Telephone_number,Emergency_number,Email,Address,Proffesion,Years_of_english_already_studied,Smoker,Special_requirements,Fax_number) VALUES ('$title','$First_name','$username','$Second_name','$password','$DOB','$Nationality','$Tel','$emergency_tel','$email','$address','$Proffesion','$number_years','$smoke','$Special_requirements','$faxnumber')"; //end of query one // Variable for Course details part of form $Course_name=mysql_real_escape_string($_POST['Course_name']); $Course_start_date=mysql_real_escape_string($_POST['Course_start_date']); $Course_end_date=mysql_real_escape_string($_POST['Course_end_date']); $Number_of_weeks=mysql_real_escape_string($_POST['Number_of_weeks']); //end Variables // Sql Query sends all data from the form into the Course table $course_details="INSERT INTO Course (Course_Name,Course_start_date,Course_end_date,Number_of_weeks) VALUES ('$Course_name','$Course_start_date','$Course_end_date','$Number_of_weeks')"; // end of query //Variable for Accomodation part of form $accomodation_type=mysql_real_escape_string($_POST['accomodation_type']); $accomodation_start_date=mysql_real_escape_string($_POST['accomodation_start_date']); $accomodation_end_date=mysql_real_escape_string($_POST['accomodation_end_date']); //end variables // Sql Query sends all data from the form into the accomodation table $accomodation_details="INSERT INTO Accomodation (Type_of_accommodation,Accom_Start_date,Accom_End_date) VALUES ('$accomodation_type','$accomodation_start_date','$accomodation_end_date')"; // end of query //Variable for flight part of form $airport_transfer=mysql_real_escape_string($_POST['airport_transfer']); $Arrival_date=mysql_real_escape_string($_POST['Arrival_date']); $Departure_date=mysql_real_escape_string($_POST['Departure_date']); $Arrival_flight_no=mysql_real_escape_string($_POST['Arrival_flight_no']); $Departure_flight_no=mysql_real_escape_string($_POST['Departure_flight_no']); $Arrival_time=mysql_real_escape_string($_POST['Arrival_time']); $Departure_time=mysql_real_escape_string($_POST['Departure_time']); $arrival_airport=mysql_real_escape_string($_POST['arrival_airport']); $departure_airport=mysql_real_escape_string($_POST['departure_airport']); //end variables // Sql Query sends all data from the form into the flight table $flight_details="INSERT INTO Flight (Arrival_flight_no,departure_flight_no,arrival_date,departure_date,arrival_time,departure_time,Arrival_airport,departure_airport,Transfer_needed) VALUES ('$Arrival_flight_no','$Departure_flight_no','$Arrival_date','$Departure_date','$Arrival_time','$Departure_time','$arrival_airport','$departure_airport','$airport_transfer')"; // end of query //Variable for payment part of form $payment_details=mysql_real_escape_string($_POST['payment_details']); $payment_type=mysql_real_escape_string($_POST['payment_type']); $card_type=mysql_real_escape_string($_POST['card_type']); $card_holders_name=mysql_real_escape_string($_POST['card_holders_name']); $card_holders_address=mysql_real_escape_string($_POST['card_holders_address']); $card_number=mysql_real_escape_string($_POST['card_number']); $card_expiry_date=mysql_real_escape_string($_POST['card_expiry_date']); $cv_number=mysql_real_escape_string($_POST['cv_number']); //end variables //Sql Query sends all data from the form to the payment table $payment_details="INSERT INTO Payment (Deposit_or_full,Payment_type,Card_type,Cardholders_name,Cardholders_address,Card_number,Card_ccv,Expiry_date) VALUES ('$payment_details','$payment_type','$card_type','$card_holders_name','$card_holders_address','$card_number','$cv_number','$card_expiry_date')"; //end query //******************execute sql statements******************************* // //Execute sql statement 1 if (!mysql_query($student_details,$conn)) { die('Error: ' . mysql_error()); } //Execute sql statement 2 if (!mysql_query($course_details,$conn)) { die('Error: ' . mysql_error()); } //Execute sql statement 3 if (!mysql_query($accomodation_details,$conn)) { die('Error: ' . mysql_error()); } //Execute sql statement 4 if (!mysql_query($flight_details,$conn)) { die('Error: ' . mysql_error()); } //Execute sql statement 5 if (!mysql_query($payment_details,$conn)) { die('Error: ' . mysql_error()); } //******************end sql statements******************************* // echo "<h2>Thanks For submittiing the data to the us, we will be in-touch shortly</h2><br />"; include("db/close_connection.php"); //close db connection ?> </div> </div> <div id="footer"> <?php include("includes/footer.html"); ?> </div> </div> </body> </html>
  8. Any body, im pretty sure its relatively easy???
  9. hi i found this link for a really easy callender implementation. http://www.javascriptkit.com/script/script2/tengcalendar.shtml just cant seem to get it to work can someone take a look at my code and just give me a pointer please. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- callender java script --> <script language="javascript" type="text/javascript" src="datetimepicker.js"> //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com //Script featured on JavaScript Kit (http://www.javascriptkit.com) //For this script, visit http://www.javascriptkit.com </script> <!-- End of script --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>booking</title> <?php include("includes/ico.html"); ?> <link rel="stylesheet" href="css/layout.css" type="text/css" media="screen" /> <style type="text/css"> <!-- .style3 {color: #FF0000} .style4 {color: #FF0000; font-weight: bold; } .style5 {color: #666666} --> </style> </head> <body> <div id="container"> <div id="header"><?php include("includes/language.html"); ?></div> <div id="sidebar"> <?php include("includes/navigation.html"); ?> </div> <div id="content"> <h1 align="center">Booking Form</h1> <p> </p> <FORM ACTION="book_process.php" METHOD="POST" NAME="booking_form"> <table width="89%" border="0" align="center" cellpadding="3" cellspacing="3"> <tr><td colspan="4"><p>-------------------------------------------------------Student Details-----------------------------------------------------------------</p></td></tr> <tr> <td width="14%" bgcolor="#CCCCCC"> <label></label> <br /> <br /> <label></label> <p>Title</p><br /> <br /> <label></label></td> <td width="37%" bgcolor="#CCCCCC"><label> <input name="title" type="radio" value="mr" /> Mr</label> <label> <input name="title" type="radio" value="Mrs" /> Mrs</label> <label> <input name="title" type="radio" value="Ms" /> Ms</label> <label> <input name="title" type="radio" value="Miss" /> Miss</label> </td> <td width="11%" bgcolor="#FFFFFF"> </td> <td width="38%"> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>First_name </p> </td> <td bgcolor="#CCCCCC"><input name="First_name" type="text" id="First_name" /></td> <td bgcolor="#CCCCCC"><p>Username </p></td> <td bgcolor="#CCCCCC"><input name="username" type="text" id="username" /></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Second_name </p> </td> <td bgcolor="#CCCCCC"><input name="Second_name" type="text" id="Second_name" /></td> <td bgcolor="#CCCCCC"><p>Password</p></td> <td bgcolor="#CCCCCC"><input name="password" type="password" id="password" /></td> </tr> <tr> <td height="30" bgcolor="#CCCCCC"><p>DOB</p></td> <td bgcolor="#CCCCCC"> <input name="DOB" type="text" id="DOB" /> <span class="style4" id="msg">(yyyy-mm-dd)</span></td> <td bgcolor="#FFFFFF"> </td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Nationality</p></td> <td bgcolor="#CCCCCC"><select name="Nationality" size="1" class="style1"> <option selected="selected">Select Nationality</option> <option value="Not listed">Not listed</option> <option>------------------------------------------</option> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="Angola">Angola</option> <option value="Argentina">Argentina</option> <option value="Armenia">Armenia</option> <option value="Austria">Austria</option> <option value="Azerbaijan">Azerbaijan</option> <option value="Bahrain">Bahrain</option> <option value="Belarus">Belarus</option> <option value="Belgium">Belgium</option> <option value="Bolivia">Bolivia</option> <option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option> <option value="Brazil">Brazil</option> <option value="Bulgaria">Bulgaria</option> <option value="Chile">Chile</option> <option value="China">China</option> <option value="Colombia">Colombia</option> <option value="Costa Rica">Costa Rica</option> <option value="Croatia">Croatia</option> <option value="Cyprus">Cyprus</option> <option value="Czech Republic">Czech Republic</option> <option value="Denmark">Denmark</option> <option value="Dominican Republic">Dominican Republic</option> <option value="Ecuador">Ecuador</option> <option value="Ecuador">Egypt</option> <option value="El Salvador">El Salvador</option> <option value="Estonia">Estonia</option> <option value="Finland">Finland</option> <option value="France">France</option> <option value="Gambia">Gambia</option> <option value="Georgia">Georgia</option> <option value="Germany">Germany</option> <option value="Greece">Greece</option> <option value="Guatemala">Guatemala</option> <option value="Hong Kong">Hong Kong</option> <option value="Hungary">Hungary</option> <option value="Iceland">Iceland</option> <option value="India">India</option> <option value="Indonesia">Indonesia</option> <option value="Iran">Iran</option> <option value="Ireland">Ireland</option> <option value="Israel">Israel</option> <option value="Italy">Italy</option> <option value="Japan">Japan</option> <option value="Jordan">Jordan</option> <option value="Kazakhstan">Kazakhstan</option> <option value="Korea">Korea</option> <option value="Kuwait">Kuwait</option> <option value="Kyrgyzstan">Kyrgyzstan</option> <option value="Latvia">Latvia</option> <option value="Lebanon">Lebanon</option> <option value="Libya">Libya</option> <option value="Lithuania">Lithuania</option> <option value="Macedonia">Macedonia</option> <option value="Malaysia">Malaysia</option> <option value="Malta">Malta</option> <option value="Mauritania">Mauritania</option> <option value="Mexico">Mexico</option> <option value="Moldova">Moldova</option> <option value="Mongolia">Mongolia</option> <option value="Morocco">Morocco</option> <option value="Namibia">Namibia</option> <option value="Netherlands">Netherlands</option> <option value="Nicaragua">Nicaragua</option> <option value="Norway">Norway</option> <option value="Oman">Oman</option> <option value="Pakistan">Pakistan</option> <option value="Panama">Panama</option> <option value="Paraguay">Paraguay</option> <option value="Peru">Peru</option> <option value="Poland">Poland</option> <option value="Portugal">Portugal</option> <option value="Puerto Rico">Puerto Rico</option> <option value="Qatar">Qatar</option> <option value="Romania">Romania</option> <option value="Russia">Russia</option> <option value="Saudi Arabia">Saudi Arabia</option> <option value="Senegal">Senegal</option> <option value="Serbia and Montenegro">Serbia and Montenegro</option> <option value="Slovakia">Slovakia</option> <option value="Slovenia">Slovenia</option> <option value="Spain">Spain</option> <option value="Sweden">Sweden</option> <option value="Swiss French">Swiss French</option> <option value="Swiss German">Swiss German</option> <option value="Swiss Italian">Swiss Italian</option> <option value="Syria">Syria</option> <option value="Taiwan">Taiwan</option> <option value="Tajikistan">Tajikistan</option> <option value="Thailand">Thailand</option> <option value="Tunisia">Tunisia</option> <option value="Turkey">Turkey</option> <option value="Turkmenistan">Turkmenistan</option> <option value="Ukraine">Ukraine</option> <option value="United Arab Emirates">United Arab Emirates</option> <option value="Uruguay">Uruguay</option> <option value="Uzbekistan">Uzbekistan</option> <option value="Venezuela">Venezuela</option> <option value="Vietnam">Vietnam</option> <option value="Yemen">Yemen</option> </select><br /><p align="left">Any nationalities not listed above, </p> <p align="left">please contact the school via fax or e-mail</p></td> <td bgcolor="#FFFFFF"> </td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Telephone number</p></td> <td bgcolor="#CCCCCC"><input name="Tel" type="text" id="Tel" /></td> <td bgcolor="#CCCCCC"><p>Emergency</p> <p>Telephone</p> <p> number</p></td> <td bgcolor="#CCCCCC"><input name="emergency_tel" type="text" id="emergency_tel" /></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Email </p></td> <td bgcolor="#CCCCCC"> <input name="email" type="text" id="email" /></td> <td bgcolor="#FFFFFF"> </td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <td height="46" bgcolor="#CCCCCC"><p>Address</p></td> <td bgcolor="#CCCCCC"><textarea name="address" id="address"></textarea></td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Proffesion</p></td> <td bgcolor="#CCCCCC"><p> <input name="Proffesion" type="text" id="Proffesion" /> <br /> If you require a <strong>VISA</strong> you <strong>MUST</strong> put a fax number for your visa letter.</p></td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Fax Number </p></td> <td bgcolor="#CCCCCC"><input name="faxnumber" type="text" id="faxnumber" /></td> <td> </td> <td> </td> </tr> <tr> <td height="18" colspan="4"><p>-------------------------------------------------------Course Details------------------------------------------------------------------</p></td> </tr> <tr> <td bgcolor="#CCCCCC"><p align="left">Years of<br /> English already studied:</p></td> <td bgcolor="#CCCCCC"><select name="years_of_study" id="years_of_study"> <option>Over 5 Years Of English Studies</option> <option>4 - 5 Years Of English Studies</option> <option>2 - 3 Years Of English Studies</option> <option>Beginer Or Very Elementery</option> </select> </td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Course Name</p></td> <td bgcolor="#CCCCCC"><label> <select name="Course_name" id="select"> <option>General English</option> <option>Examination English</option> <option>Buisness English</option> </select> </label></td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Course <br /> Start Date</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="Course_start_date" id="Course_start_date" /> </label></td> <td bgcolor="#CCCCCC"><p>Course<br /> End Date</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="Course_end_date" id="Course_end_date" /> </label></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Number <br /> of Weeks</p></td> <td bgcolor="#CCCCCC"><label> <select name="Number_of_weeks" id="Number_of_weeks"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> <option>32</option> <option>33</option> <option>34</option> <option>35</option> <option>36</option> <option>37</option> <option>38</option> <option>39</option> <option>40</option> </select> </label></td> <td> </td> <td> </td> </tr> <tr> <td height="28" colspan="4"><p>-------------------------------------------------------Accommodation Details--------------------------------------------------------</p></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Type of<br /> Accommodation required:</p></td> <td bgcolor="#CCCCCC"><label> <select name="accomodation_type" id="accomodation_type"> <option selected="selected">Homestay_Single</option> <option>Homestay_Twin</option> <option>No_Accomodation</option> </select> </label></td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Start Date</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="accomodation_start_date" id="accomodation_start_date" /> </label></td> <td bgcolor="#CCCCCC"><p>End Date</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="accomodation_end_date" id="accomodation_end_date" /> </label></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Do you Smoke</p></td> <td bgcolor="#CCCCCC"><label> <input type="radio" name="Smoke" value="Yes" /> Yes </label> <label> <input type="radio" name="Smoke" value="No" /> No</label></td> <td> </td> <td> </td> </tr> <tr> <td height="61" colspan="2" bgcolor="#CCCCCC"><p>Do you have any special requirements or any health problems? (Please note that we can only accept special requests regarding health or religion).</p> </td> <td colspan="2" bgcolor="#CCCCCC"><label> <textarea name="Special_requirements" id="Special_requirements" cols="45" rows="5"></textarea> </label></td> </tr> <tr> <td colspan="4"><p>-------------------------------------------------------Travel Details--------------------------------------------------------------------</p></td> </tr> <tr> <td colspan="2" bgcolor="#CCCCCC"><p>Do you require a transfer from the airport to your accommodation?</p> </td> <td colspan="2" bgcolor="#CCCCCC"><label> <select name="airport_transfer" id="airport_transfer"> <option>Arrival Transfer Only</option> <option>Arrival And Departure Transfer</option> <option>I Do Not Require A Transfer</option> </select> </label><br /> </td> </tr> <tr> <td colspan="4"> <p align="left" class="style3">If you require an airport transfer please complete the following sections (please complete both sections if you require an arrival and a departure transfer)</p></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Arrival date:</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="Arrival_date" id="Arrival_date" /> <a href="javascript:Arrival_date('demo1','ddmmyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> </label></td> <td bgcolor="#CCCCCC"><p>Departure date:</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="Departure_date" id="Departure_date" /> </label></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Arrival Flight<br /> Number</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="Arrival_flight_no" id="Arrival_flight_no" /> </label></td> <td bgcolor="#CCCCCC"><p>Departue Flight Number</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="Departure_flight_no" id="Departure_flight_no" /> </label></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Arrival Time</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="Arrival_time" id="Arrival_time" /> </label></td> <td bgcolor="#CCCCCC"><p>Departure Time</p></td> <td bgcolor="#CCCCCC"><label> <input type="text" name="Departure_time" id="Departure_time" /> </label></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Arrival airport</p></td> <td bgcolor="#CCCCCC"><label> <select name="arrival_airport" id="arrival_airport"> <option>Bournemouth</option> <option>Southampton</option> <option>Gatwick</option> <option>Heathrow</option> <option>Luton</option> <option>Stansted</option> </select> </label></td> <td bgcolor="#CCCCCC"><p>Departure Airport</p></td> <td bgcolor="#CCCCCC"><label> <select name="departure_airport" id="departure_airport"> <option>Bournemouth</option> <option>Southampton</option> <option>Gatwick</option> <option>Heathrow</option> <option>Luton</option> <option>Standsted</option> </select> </label></td> </tr> <tr> <td colspan="4"> <p align="left" class="style4">Payment Details:</p> <p>IMPORTANT: Please note that your application cannot be processed until we have received payment of the deposit for the course or payment of the full fees for the course. If your course starts in 4 weeks or less, full payment must be made at time of registration. If you are only paying the deposit then the full balance is due 4 weeks before the course starts.</p> <p><br /> </p></td> <tr> <td bgcolor="#CCCCCC"><p>Please specify if you are paying </p> <p>the deposit only or the full fees:</p></td> <td bgcolor="#CCCCCC"><select name="payment_details" id="payment_details"> <option>GBP £100 Deposit</option> <option>Full Fees GBP</option> </select> </td> <td bgcolor="#CCCCCC"><p>Please specify your payment method</p></td> <td bgcolor="#CCCCCC"><select name="payment_type" id="payment_type"> <option>Bank Transfer</option> <option>Credit Card</option> <option>Cheque</option> </select> </td> </tr> </tr> <tr> <td colspan="4"><p><span class="style4">Paying by bank transfer IMPORTANT</span><span class="style3">:</span><br /> If you are paying by bank transfer a copy of the transfer MUST be sent by fax as your booking cannot be processed without payment. Please mark the student's name clearly on the bank transfer. Please send your transfer to the following account. <br /> <br /> <span class="style4"><span class="style5">Bank name: </span>Lloyd's TSB Plc.<br /> <span class="style5">Bank address:</span> 45 Old Christchurch Road, Bournemouth, BH1 1ED, England <br /> <span class="style5">Account name:</span> Charminster UK School of English <br /> <span class="style5">Account number:</span> 28994860 <br /> <span class="style5">Sort code:</span> 77-50-22</span></p> <p class="style4"> PLEASE CHECK THAT ALL INFORMATION IS CORRECT BEFORE PROCEEDING !</p> <p class="style4"> </p> <p class="style4"> <label></label> </p></td> </tr> <tr> <td colspan="4"><p class="style4">Paying By Credit Card</p> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Card Type</p></td> <td bgcolor="#CCCCCC"><select name="card_type" id="card_type"> <option selected="selected">Mastercard</option> <option>Visa</option> <option>American Express</option> </select> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Cardholder's name</p></td> <td bgcolor="#CCCCCC"><input type="text" name="card_holders_name" id="card_holders_name" /></td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Cardholder's address</p></td> <td bgcolor="#CCCCCC"><textarea name="card_holders_address" id="card_holders_address" cols="45" rows="5"></textarea></td> <td> </td> <td> </td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Card <br /> number<br /> (no spaces)</p></td> <td bgcolor="#CCCCCC"><input type="text" name="card_number" id="card_number" /><p>(1234-1234-1234-1234)</p></td> <td bgcolor="#CCCCCC"><p>Expiry Date</p></td> <td bgcolor="#CCCCCC"><p> <input name="card_expiry_date" type="text" id="card_expiry_date" /> mm/yy</p></td> </tr> <tr> <td bgcolor="#CCCCCC"><p>Security Number</p></td> <td bgcolor="#CCCCCC"><p> <input name="cv_number" type="text" id="cv_number" size="4" /> See Below</p></td> <td> </td> <td> </td> </tr> <tr> <td colspan="4"><span class="style4"> </span> <table cellspacing="0" cellpadding="0"> <tr> <td bordercolor="#666666" bgcolor="#FFFFFF"><p>For all cards except Amex, 3 numbers as shown on the back of your card</p></td> <td colspan="3" bordercolor="#666666" bgcolor="#FFFFFF"><p><img src="images/amex.gif" alt="card" border="0" height="82" width="137" />For Amex, 4 numbers as shown on the front of your card</p></td> </tr> <tr> <td colspan="4" bordercolor="#666666"><br /></td> </tr> </table> <span class="style4"> <label></label> </span></td> </tr> <tr> <td colspan="4"></td> </tr> <tr> <td colspan="4"><span class="style4"> <label>Declaration</label> <br /> <input type="checkbox" name="declaration" id="declaration" /> I declare that I agree to the terms and conditions of enrolment and confirm that all the information provided on this form is correct.</span></td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td></td> <td><input type="submit" name="submit" id="submit" value="Submit" /> <input type="reset" name="Reset" id="button" value="Reset" /></td> <td> </td> <td> </td> </tr> </table> </form> <p> </p> </div> <div id="footer"> <?php include("includes/footer.html"); ?> </div> </div> </body> </html>
  10. Hi guys Basically i have designed a db and written the form , i have also started writing the code to pass the data from the form to the db with sql. can just show u my data base design so you can see what i am trying to do. [u]STUDENT[/u] Student_Id Username Password Title First name Sir name Date of birth Nationality Telephone number Emergency Telephone number Email address Address Profession Fax number Years of English already studied: Do you smoke Special requirements [u] COURSE[/u] Course_id Course name: Course start date: Course end date: Number of weeks: [u]STUDENT/COURSE[/u] Student_id Course_id [u]ACCOMODATION [/u] Accommodation id Accommodation Description Type of accommodation required: Accommodation Start date: Accommodation End date: [u] STUDENT/ACCOMODATION [/u] Accommodation id Student_id [u]FLIGHT[/u] Flight_id Arrival flight no: Departure flight no: Arrival date: Departure date: Arrival time: Departure time: Arrival airport: Departure airport: Do you require a transfer from the airport to your accommodation? [u]STUDENT/FLIGHT[/u] Flight_id Student_id [u] PAYMENT[/u] Payment_id Deposit_or_full Payment_type Card_type Cardholders_name Cardholders_address Card number Security_number Expiry_date [u]PAYMENT/STUDENT[/u] Payment_id Student_id Ok so now you see the db design i have started coding the sql to get the data from the form to the db. heres a snippet. // Variable for Student details part of form $title=mysql_real_escape_string($_POST['title']); $First_name=mysql_real_escape_string($_POST['First_name']); $username=mysql_real_escape_string($_POST['username']); $Second_name=mysql_real_escape_string($_POST['Second_name']); $password=mysql_real_escape_string($_POST['password']); $DOB=mysql_real_escape_string($_POST['DOB']); $Nationality=mysql_real_escape_string($_POST['Nationality']); $Tel=mysql_real_escape_string($_POST['Tel']); $emergency_tel=mysql_real_escape_string($_POST['emergency_tel']); $email=mysql_real_escape_string($_POST['email']); $address=mysql_real_escape_string($_POST['address']); $Proffesion=mysql_real_escape_string($_POST['Proffesion']); $faxnumber=mysql_real_escape_string($_POST['faxnumber']); $number_years=mysql_real_escape_string($_POST['years_of_study']); $smoke=mysql_real_escape_string($_POST['Smoke']); $Special_requirements=mysql_real_escape_string($_POST['Special_requirements']); // End of Variables for Student details // Sql Query sends all data from the form into the student table $student_details="INSERT INTO Student (Title, First_Name,Username,Surname,Password,Dob,Nationality,Telephone_number,Emergency_number,Email,Address,Proffesion,Years_of_english_already_studied,Smoker,Special_requirements,Fax_number) VALUES ('$title','$First_name','$username','$Second_name','$password','$DOB','$Nationality','$Tel','$emergency_tel','$email','$address','$Proffesion','$number_years','$smoke','$Special_requirements','$faxnumber')"; //end of query one //******************execute sql statements******************************* // //Execute sql statement 1 if (!mysql_query($student_details,$conn)) { die('Error: ' . mysql_error()); my question is, for example how do i insert data in to for example the STUDENT/COURSE Student_id Course_id so it all links up. Do i literally just do an insert into statement, could someone please give me an example please. obviously this is a linker table, so i can find out what student is on what course etc. just wanna know how to actually send the data there? as you can see also the student_id automatically gets written to the student table in the code above, how do i send that to the student/course table as well. sorry if i dont make sense i am trying lol.
  11. Thanks So much for that, problem solved.#
  12. Hi all here is some code and i am just wondering why the sql for the Course table is not writing to the course table. I have higlighted it red so you can easily see what i mean. The sql code above it works very well , but for somereason it seems to be ignoring the code in red ??? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include("includes/ico.html"); ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <?php include("db/connection.php"); //Connection string for db?> <link rel="stylesheet" href="css/layout.css" type="text/css" media="screen" /> </head> <body> <div id="container"> <div id="header"> <?php include("includes/language.html"); ?> </div> <div id="sidebar"> <?php include("includes/navigation.html"); ?> </div> <div id="content"> <div align="center"> <?php // Variable for Student details part of form $title=mysql_real_escape_string($_POST['title']); $First_name=mysql_real_escape_string($_POST['First_name']); $username=mysql_real_escape_string($_POST['username']); $Second_name=mysql_real_escape_string($_POST['Second_name']); $password=mysql_real_escape_string($_POST['password']); $DOB=mysql_real_escape_string($_POST['DOB']); $Nationality=mysql_real_escape_string($_POST['Nationality']); $Tel=mysql_real_escape_string($_POST['Tel']); $emergency_tel=mysql_real_escape_string($_POST['emergency_tel']); $email=mysql_real_escape_string($_POST['email']); $address=mysql_real_escape_string($_POST['address']); $Proffesion=mysql_real_escape_string($_POST['Proffesion']); $faxnumber=mysql_real_escape_string($_POST['faxnumber']); $number_years=mysql_real_escape_string($_POST['years_of_study']); $smoke=mysql_real_escape_string($_POST['Smoke']); $Special_requirements=mysql_real_escape_string($_POST['Special_requirements']); // End of Variables for Student details // Sql Query sends all data from the form into the student table $student_details="INSERT INTO Student (Title, First_Name,Username,Surname,Password,Dob,Nationality,Telephone_number,Emergency_number,Email,Address,Proffesion,Years_of_english_already_studied,Smoker,Special_requirements,Fax_number) VALUES ('$title','$First_name','$username','$Second_name','$password','$DOB','$Nationality','$Tel','$emergency_tel','$email','$address','$Proffesion','$number_years','$smoke','$Special_requirements','$faxnumber')"; //end of query one [color=red][font=Verdana]// Variable for Course details part of form $Course_name=mysql_real_escape_string($_POST['Course_name']); $Course_start_date=mysql_real_escape_string($_POST['Course_start_date']); $Course_end_date=mysql_real_escape_string($_POST['Course_end_date']); $Number_of_weeks=mysql_real_escape_string($_POST['Number_of_weeks']); //end Variables $course_details="INSERT INTO Course (Course_Name,Course_start_date,Course_end_date,Number_of_weeks) VALUES ('$Course_name','$Course_start_date','$Course_end_date','$Number_of_weeks')";[/font][/color] if (!mysql_query($student_details,$conn)) { die('Error: ' . mysql_error()); } echo "<h2>Thanks For submittiing the data to the us, we will be in-touch shortly</h2><br />"; include("db/close_connection.php"); //close db connection ?> </div> </div> <div id="footer"> <?php include("includes/footer.html"); ?> </div> </div> </body> </html>
×
×
  • 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.