Jump to content

Beeeeney

Members
  • Posts

    193
  • Joined

  • Last visited

Everything posted by Beeeeney

  1. Do a var_dump() on the $_GET array. Are you using method="get" on your form? Also, "doesn't seem to be working" is a bit vague. What exactly is the problem?
  2. I'm going to teach you some very advanced HTML now, it will blow your mind. <br>
  3. This should explain: <?php if (isset($_GET['page'])) { include "includes.php"; $query = "SELECT * FROM cruise"; $result = mysql_query($query); $num=mysql_numrows($result); mysql_close(); ?> <br /><a href="form.php">Hide all bookings</a><br><br> <table border="1" cellspacing="2" cellpadding="2"> <tr> <td><font face="Arial"><b>Name</b></font></td> <td><font face="Arial"><b>Address</b></font></td> <td><font face="Arial"><b>Cruise Line</b></font></td> <td><font face="Arial"><b>Ship Name</b></font></td> <td><font face="Arial"><b>Destination</b></font></td> <td><font face="Arial"><b>Departure Date</b></font></td> <td><font face="Arial"><b>Agent Name</b></font></td> <td><font face="Arial"><b>TIMESTAMP</b></font></td> </tr> <?php $i=0; while ($i < $num) { $Name=mysql_result($result,$i,"Name"); $Address=mysql_result($result,$i,"Address"); $CruiseLine=mysql_result($result,$i,"Cruise_Line"); $ShipName=mysql_result($result,$i,"Ship_Name"); $Destination=mysql_result($result,$i,"Destination"); $DepartureDate=mysql_result($result,$i,"Departure_Date"); $AgentName=mysql_result($result,$i,"Agent_Name"); $TimeStamp=mysql_result($result,$i,"TIMESTAMP"); ?> <tr> <td><font face="arial"><?php echo $Name; ?></font></td> <td><font face="arial"><?php echo $Address; ?></font></td> <td><font face="arial"><?php echo $CruiseLine; ?></font></td> <td><font face="arial"><?php echo $ShipName; ?></font></td> <td><font face="arial"><?php echo $Destination; ?></font></td> <td><font face="arial"><?php echo $DepartureDate; ?></font></td> <td><font face="arial"><?php echo $AgentName; ?></font></td> <td><font face="arial"><?php echo $TimeStamp; ?></font></td> </tr> <?php $i++; } } ?> Made that for work when I first started learning PHP. Very simple.
  4. I'm not sure what you're asking but I think that the answer is yes. You can just do the ol' fashioned link to stylesheet at the top of each of your files. You can include 100 files within another 100 files if you want.
  5. hey d00d is this ur code <br /> <b>Warning</b>: mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]: (28000/1045): Access denied for user 'root'@'localhost' (using password: NO) in <b>/home/vol3/0fees.net/fees0_11240271/htdocs/GardenableImproved/core/get_specific_product.php</b> on line <b>3</b><br /> <iframe src='http://ifastnet.com/pop.html' name='frame1' scrolling='no' frameborder='no' align='center' MARGINWIDTH='0' MARGINHEIGHT='0' height = '10px' width = '10px'> </iframe><br /> <b>Warning</b>: mysqli::prepare() [<a href='mysqli.prepare'>mysqli.prepare</a>]: Couldn't fetch mysqli in <b>/home/vol3/0fees.net/fees0_11240271/htdocs/GardenableImproved/core/get_specific_product.php</b> on line <b>5</b><br /> <iframe src='http://ifastnet.com/pop.html' name='frame1' scrolling='no' frameborder='no' align='center' MARGINWIDTH='0' MARGINHEIGHT='0' height = '10px' width = '10px'> </iframe><br /> <b>Warning</b>: mysqli_error() expects exactly 1 parameter, 0 given in <b>/home/vol3/0fees.net/fees0_11240271/htdocs/GardenableImproved/core/get_specific_product.php</b> on line <b>5</b><br /> <iframe src='http://ifastnet.com/pop.html' name='frame1' scrolling='no' frameborder='no' align='center' MARGINWIDTH='0' MARGINHEIGHT='0' height = '10px' width = '10px'> </iframe>Error: I have all of your source files. But seriously I do.
  6. Don't go to w3schools.com to learn anything. Some of it is bad information.
  7. You're not typing "localhost/htdocs/page.php" in the address bar, are you?
  8. I showed you the actual code I was using, but I'll fire up my editor and show you the exact code. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <head> <?php include("includeDOB.php"); ?> <title>Form</title> <link type="text/css" rel="stylesheet" href="style2.css"> </head> <body> <script type="text/javascript"> function is_numeric(a) { var e = /^[0-9]+$/; if (a.match(e)) { return true; } return false; } var mobile = document.forms.CustomerInformation.Mobilenumber.value; function validatePage() { var msg=""; if (document.forms.CustomerInformation.Title.value == "Please Choose") { msg += "* Please provide a Title\n"; } else { msg += ""; } if (document.forms.CustomerInformation.Firstname.value == "") { msg += "* Please provide a First Name\n"; } if (document.forms.CustomerInformation.Lastname.value == "") { msg += "* Please provide a Surname\n"; } if (document.forms.CustomerInformation.Nationality.value == "") { msg += "* Please provide a Nationality\n"; } if (document.forms.CustomerInformation.Issuecountry.value == "") { msg += "* Please provide a Country of Issue\n"; } if (document.forms.CustomerInformation.Fullname.value == "") { msg += "* Please provide a Full name for your next of kin\n"; } if (document.forms.CustomerInformation.Address.value == "") { msg += "* Please provide an Address for your next of kin\n"; } if (document.forms.CustomerInformation.Postcode.value == "") { msg += "* Please provide a Postcode for your next of kin\n"; } if (document.forms.CustomerInformation.Relationship.value == "") { msg += "* Please give details of your Relationship to your next of kin\n"; } if ((mobile == "") || !is_numeric(mobile)) { msg += "* Please provide a Mobile Number for your next of kin\n"; } if (document.forms.CustomerInformation.checkbox.checked == false) { msg += "\n* Please read and agree to the Terms and Conditions\n"; } if (msg == "") { return true; } else { alert("This form cannot be submitted. Please correct the following issue(s):\n\n"+ msg); return false; } } </script> <img class="pclogo" src="http://planetcruise.co.uk/images/header/nav/logo3_Rev%20A.jpg"> <form action="submit.php" method="post" name="CustomerInformation" onsubmit="return validatePage()"> <br><br><br> <span class="span1">Booking Reference: <input type="text" name="Bookingreference"></span><br><br><br><br> <div class="rightstuff"> <br><br><br><br> <select name="Title"><option selected>Please Choose</option> <option value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Mr">Ms</option> <option value="Dr">Dr</option> </select> <br> <input type="text" name="Firstname"><br> <input type="text" name="Middlename"><br> <input type="text" name="Lastname"><br> <?php echo $form1; ?> <!--$form1 can be found in "includeDOB.php" --><br><br> <br><br><br><input type="text" name="PassportNo"><br> <?php echo $form2; ?><br> <!--$form2 can be found in "includeDOB.php" --> <?php echo $form3; ?><br> <!--$form3 can be found in "includeDOB.php" --> <input type="text" name="Nationality"><br> <input type="text" name="Issuecountry"><br><br> <!-- NEXT OF KIN INFO v --> <br><br><input type="text" name="Fullname"><br> <input type="text" name="Address"><br> <input type="text" name="Postcode"><br> <input type="text" name="Relationship"><br> <input type="text" name="Mobilenumber"><br> <input type="text" name="Daytimephone"><br> <input type="text" name="Eveningphone"><br> <input type="text" name="Email"><br><br> <!--TRAVEL INSURANCE DETAILS--> <br><br><br><input type="text" name="Company"><br> <input type="text" name="Policynumber"><br> <input type="text" name="Underwriter"><br> <input type="text" name="Emergencynumber"><br><br><br></div> <div class="leftstuff"><h1>Personal Information</h1><br> <!--PERSONAL INFORMATION --> Title:*<br>First Name:*<br>Middle Name:<br>Last Name:*<br>Last Name:*<br>Date of Birth:*<br><br><h1>Passport Details</h1><br>Passport Number:*<br>Date of Issue:*<br>Date of Expiry:*<br>Nationality:*<br>Issue Country:*<br><br><h1>Next of Kin Information</h1><br>Full Name:*<br>Address:*<br>Postcode:*<br>Relationship:*<br>Mobile Number:*<br>Daytime Phone:<br>Evening Phone:<br>Email Address:<br><br><h1>Travel Insurance Details</h1><br>Insurance Company:<br>Policy Number:<br>Medical Company Name:<br>Emergency Medical Contact Number:<br><br><br><span class="bottomtext">I have read and agree to the <a target="_blank" href="http://planetcruise.co.uk/about-planet-cruise/terms">terms and conditions</a></span> <input type="checkbox" name="checkbox"><br><br><input type="submit" value="Submit"><br><br></div> </form> </body> </html>
  9. I do have an error, apparently: Uncaught TypeError: Cannot read property 'Mobilenumber' of undefined No reason for this error to be here.
  10. I even tested it with your updated code and for some reason it is still completely skipping validation. <script type="text/javascript"> function is_numeric(a) { var e = /^[0-9]+$/; if (a.match(e)) { return true; } return false; } var mobile = document.forms.CustomerInformation.Mobilenumber.value; function validatePage() { var msg=""; if (document.forms.CustomerInformation.Title.value == "Please Choose") { msg += "* Please provide a Title\n"; } else { msg += ""; } if (document.forms.CustomerInformation.Firstname.value == "") { msg += "* Please provide a First Name\n"; } if (document.forms.CustomerInformation.Lastname.value == "") { msg += "* Please provide a Surname\n"; } if (document.forms.CustomerInformation.Nationality.value == "") { msg += "* Please provide a Nationality\n"; } if (document.forms.CustomerInformation.Issuecountry.value == "") { msg += "* Please provide a Country of Issue\n"; } if (document.forms.CustomerInformation.Fullname.value == "") { msg += "* Please provide a Full name for your next of kin\n"; } if (document.forms.CustomerInformation.Address.value == "") { msg += "* Please provide an Address for your next of kin\n"; } if (document.forms.CustomerInformation.Postcode.value == "") { msg += "* Please provide a Postcode for your next of kin\n"; } if (document.forms.CustomerInformation.Relationship.value == "") { msg += "* Please give details of your Relationship to your next of kin\n"; } if ((mobile == "") || !is_numeric(mobile)) { msg += "* Please provide a Mobile Number for your next of kin\n"; } if (document.forms.CustomerInformation.checkbox.checked == false) { msg += "\n* Please read and agree to the Terms and Conditions\n"; } if (msg == "") { return true; } else { alert("This form cannot be submitted. Please correct the following issue(s):\n\n"+ msg); return false; } } </script>
  11. The whole page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <head> <?php include("includeDOB.php"); ?> <title>Form</title> <link type="text/css" rel="stylesheet" href="style2.css"> </head> <body> <script type="text/javascript"> function validatePage() { var msg=""; if (document.forms.CustomerInformation.Title.value == "Please Choose") { msg += "* Please provide a Title\n"; } else { msg += ""; } if (document.forms.CustomerInformation.Firstname.value == "") { msg += "* Please provide a First Name\n"; } if (document.forms.CustomerInformation.Lastname.value == "") { msg += "* Please provide a Surname\n"; } if (document.forms.CustomerInformation.Nationality.value == "") { msg += "* Please provide a Nationality\n"; } if (document.forms.CustomerInformation.Issuecountry.value == "") { msg += "* Please provide a Country of Issue\n"; } if (document.forms.CustomerInformation.Fullname.value == "") { msg += "* Please provide a Full name for your next of kin\n"; } if (document.forms.CustomerInformation.Address.value == "") { msg += "* Please provide an Address for your next of kin\n"; } if (document.forms.CustomerInformation.Postcode.value == "") { msg += "* Please provide a Postcode for your next of kin\n"; } if (document.forms.CustomerInformation.Relationship.value == "") { msg += "* Please give details of your Relationship to your next of kin\n"; } if (document.forms.CustomerInformation.Mobilenumber.value == "") { msg += "* Please provide a Mobile Number for your next of kin\n"; } if (document.forms.CustomerInformation.checkbox.checked == false) { msg += "\n* Please read and agree to the Terms and Conditions\n"; } if (msg == "") { return true; } else { alert("This form cannot be submitted. Please correct the following issue(s):\n\n"+ msg); return false; } } </script> <img class="pclogo" src="http://planetcruise.co.uk/images/header/nav/logo3_Rev%20A.jpg"> <form action="submit.php" method="post" name="CustomerInformation" onsubmit="return validatePage()"> <br><br><br> <span class="span1">Booking Reference: <input type="text" name="Bookingreference"></span><br><br><br><br> <div class="rightstuff"> <br><br><br><br> <select name="Title"><option selected>Please Choose</option> <option value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Mr">Ms</option> <option value="Dr">Dr</option> </select> <br> <input type="text" name="Firstname"><br> <input type="text" name="Middlename"><br> <input type="text" name="Lastname"><br> <?php echo $form1; ?> <!--$form1 can be found in "includeDOB.php" --><br><br> <br><br><br><input type="text" name="PassportNo"><br> <?php echo $form2; ?><br> <!--$form2 can be found in "includeDOB.php" --> <?php echo $form3; ?><br> <!--$form3 can be found in "includeDOB.php" --> <input type="text" name="Nationality"><br> <input type="text" name="Issuecountry"><br><br> <!-- NEXT OF KIN INFO v --> <br><br><input type="text" name="Fullname"><br> <input type="text" name="Address"><br> <input type="text" name="Postcode"><br> <input type="text" name="Relationship"><br> <input type="text" name="Mobilenumber"><br> <input type="text" name="Daytimephone"><br> <input type="text" name="Eveningphone"><br> <input type="text" name="Email"><br><br> <!--TRAVEL INSURANCE DETAILS--> <br><br><br><input type="text" name="Company"><br> <input type="text" name="Policynumber"><br> <input type="text" name="Underwriter"><br> <input type="text" name="Emergencynumber"><br><br><br></div> <div class="leftstuff"><h1>Personal Information</h1><br> <!--PERSONAL INFORMATION --> Title:*<br>First Name:*<br>Middle Name:<br>Last Name:*<br>Last Name:*<br>Date of Birth:*<br><br><h1>Passport Details</h1><br>Passport Number:*<br>Date of Issue:*<br>Date of Expiry:*<br>Nationality:*<br>Issue Country:*<br><br><h1>Next of Kin Information</h1><br>Full Name:*<br>Address:*<br>Postcode:*<br>Relationship:*<br>Mobile Number:*<br>Daytime Phone:<br>Evening Phone:<br>Email Address:<br><br><h1>Travel Insurance Details</h1><br>Insurance Company:<br>Policy Number:<br>Medical Company Name:<br>Emergency Medical Contact Number:<br><br><br><span class="bottomtext">I have read and agree to the <a target="_blank" href="http://planetcruise.co.uk/about-planet-cruise/terms">terms and conditions</a></span> <input type="checkbox" name="checkbox"><br><br><input type="submit" value="Submit"><br><br></div> </form> </body> </html> includeDOB.php <?php $form1 = "<select name=\"day1\">\n"; $day1=1; while($day1<32) { $form1 .= "<option value=\"{$day1}\">{$day1}</option> "; $day1++; } $form1 .= "</select>\n \n <select name=\"month1\">\n"; $month1 = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "Novermber", "December"); foreach ($month1 as $key) { $form1 .= "<option value=\"{$key}\">{$key}</option>\n "; } $form1 .= "</select>\n \n <select name=\"year1\">\n"; $year1=1901; while($year1<2012 && $year1 > 1900) { $form1 .= "<option value=\"{$year1}\">{$year1}</option>\n "; $year1++; } $form1 .= "</select> \n"; ?> <?php $form2 = "<select name=\"day2\">\n"; $day2=1; while($day2<32) { $form2 .= "<option value=\"{$day2}\">{$day2}</option> "; $day2++; } $form2 .= "</select>\n \n <select name=\"month2\">\n"; $month2 = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "Novermber", "December"); foreach ($month2 as $key) { $form2 .= "<option value=\"{$key}\">{$key}</option>\n "; } $form2 .= "</select>\n \n <select name=\"year2\">\n"; $year2=1901; while($year2<2012 && $year2 > 1900) { $form2 .= "<option value=\"{$year2}\">{$year2}</option>\n "; $year2++; } $form2 .= "</select> \n"; ?> <?php $form3 = "<select name=\"day3\">\n"; $day3=1; while($day3<32) { $form3 .= "<option value=\"{$day3}\">{$day3}</option> "; $day3++; } $form3 .= "</select>\n \n <select name=\"month3\">\n"; $month3 = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "Novermber", "December"); foreach ($month3 as $key) { $form3 .= "<option value=\"{$key}\">{$key}</option>\n "; } $form3 .= "</select>\n \n <select name=\"year3\">\n"; $year3=1901; while($year3<2012 && $year3 > 1900) { $form3 .= "<option value=\"{$year3}\">{$year3}</option>\n "; $year3++; } $form3 .= "</select> \n"; ?>
  12. Anything I add to my validatePage() function just makes it completely skip all validation. I just tried your code and while I am sure that it would work, it completely ruins my whole validation. Any ideas as to why?
  13. I see how that would work, but I do not see how I could integrate that into my code. I rarely use Javascript and although this is basic stuff, I have no idea how to integrate it.
  14. To say you'll never use them again is a bit much, isn't it? I don't want you to leave this forum thinking that for loops and while loops are bad form. Use them for their intended purposes!
  15. There isn't really a reason that you shouldn't be using foreach for your purpose. I think you're just being awkward.
  16. I tried that, and now the form just skips validation altogether and just submits to my database.
  17. I kinda need some help with a form. I need some Javascript to check if something submitted is an integer. I've googled it but the results I got looked unnecessarily complex. Here's some code 'n stuff. <script type="text/javascript"> function validatePage() { var msg=""; if (document.forms.CustomerInformation.Title.value == "Please Choose") { msg += "* Please provide a Title\n"; } else { msg += ""; } if (document.forms.CustomerInformation.Firstname.value == "") { msg += "* Please provide a First Name\n"; } if (document.forms.CustomerInformation.Lastname.value == "") { msg += "* Please provide a Surname\n"; } if (document.forms.CustomerInformation.Nationality.value == "") { msg += "* Please provide a Nationality\n"; } if (document.forms.CustomerInformation.Issuecountry.value == "") { msg += "* Please provide a Country of Issue\n"; } if (document.forms.CustomerInformation.Fullname.value == "") { msg += "* Please provide a Full name for your next of kin\n"; } if (document.forms.CustomerInformation.Address.value == "") { msg += "* Please provide an Address for your next of kin\n"; } if (document.forms.CustomerInformation.Postcode.value == "") { msg += "* Please provide a Postcode for your next of kin\n"; } if (document.forms.CustomerInformation.Relationship.value == "") { msg += "* Please give details of your Relationship to your next of kin\n"; } if (document.forms.CustomerInformation.Mobilenumber.value == "") { msg += "* Please provide a Mobile Number for your next of kin\n"; } if (document.forms.CustomerInformation.checkbox.checked == false) { msg += "\n* Please read and agree to the Terms and Conditions\n"; } if (msg == "") { return true; } else { alert("This form cannot be submitted. Please correct the following issue(s):\n\n"+ msg); return false; } } </script> I want to test the "Mobilenumber" value for an integer. Any help would be appreciated.
×
×
  • 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.