Jump to content

Beeeeney

Members
  • Posts

    193
  • Joined

  • Last visited

Everything posted by Beeeeney

  1. I'm building a form for our website where customers enter their information. Not sure how best to explain my problem but basically there are 3 points on the form where the date must be submitted. I have the code for generating a date dropdown in an include file, but with Javascript validation I need all of the dropdowns to be named seperately. Does anyone understand what I mean? Generate dropdowns (includeDOB.php): <select> <option selected>Select</option> <?php $day=1; while($day<32) { ?> <option value="<?php echo $day; ?>"><?php echo $day; ?></option> <?php $day++; } ?> </select> <select> <option selected>Select</option> <?php $month = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "Novermber", "December"); foreach ($month as $key) { ?> <option value="<?php echo $key; ?>"><?php echo $key; ?></option> <?php } ?> </select> <select> <option selected>Select</option> <?php $year=1901; while($year<2012 && $year > 1900) { ?> <option value="<?php echo $year; ?>"><?php echo $year; ?></option> <?php $year++; } ?> </select> Form: <form action="submit.php" method="post" name="CustomerInformation" onsubmit="return validatePage()"> Booking Reference: <input type="text" name="Bookingreference"><br> <h1>Passport Details</h1> <!--PASSPORT INFORMATION --> Title: <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> First Name: <input type="text" name="Firstname"><br> Middle Name:<input type="text" name="Middlename"><br> Last Name: <input type="text" name="Lastname"><br> Date of Birth: <?php include("includeDOB.php"); ?> <br>Passport Number: <input type="text" name="PassportNo"><br> Date of Issue: <?php include("includeDOB.php"); ?><br> Date of Expiry: <?php include("includeDOB.php"); ?><br> Nationality: <input type="text" name="Nationality"><br> Issue Country: <input type="text" name="Issuecountry"><br> <h1>Next of Kin Information</h1> <!--NEXT OF KIN INFO v --> Full Name: <input type="text" name="Fullname"><br> Address: <input type="text" name="Address"><br> Postcode: <input type="text" name="Postcode"><br> Relationship: <input type="text" name="Relationship"><br> Mobile Number: <input type="text" name="Mobilenumber"><br> Daytime Phone: <input type="text" name="Daytimephone"><br> Evening Phone: <input type="text" name="Eveningphone"><br> Email Address: <input type="text" name="Email"><br> <h1>Travel Insurance Details</h1> <!--TRAVEL INSURANCE DETAILS--> Insurance Company: <input type="text" name="Company"><br> Policy Number: <input type="text" name="Policynumber"><br> Medical Company Name:<input type="text" name="Underwriter"><br> Emergency Medical Contact Number:<input type="text" name="Emergencynumber"><br><br> I have read and agree to the <a href="#">terms and conditions</a><input type="checkbox" name="checkbox"> <br><br><input type="submit" value="Submit"> </form> </body> </html> Javascript validation: <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 += "* 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> Basically I need to validate the Date of Birth, Date of Issue and Date of Expiry separately. I may be missing something simple but I don't want to have 3 different include files for each date entry.
  2. Well, actually, I'd like to do it via the .htaccess file. I know nothing of this so I suppose it's a good time to learn, but looking at it is all gibberish to me. Where would I put the Options -Indexes? Also, do I prefix it with RewriteRule?
  3. Our company website is well, badly coded to say the least. But there's one feature of it that seems like it could be a vulnerability to me. http://www.planetcruise.co.uk/images
  4. Fair enough. Please not that my PHP knowledge is limited.
  5. The PHP is within PHP. $b = array( "<?php echo elementCreate($1); ?>", ); You're already using PHP when declaring the $b variable, right? Then inside the variable contents you're trying to open a PHP tag.
  6. That's not a comment, that's a string. Edit: Looks like you're opening PHP tags inside PHP code. Why?
  7. Use code tags, also I can't find that bit of code from your first post in the big jumbled up mess. Probably best to use an external style sheet too.
  8. Not quite sure what you're asking.
  9. I wasn't intentionally being a jerk, I'm sorry.
  10. I don't think so, considering the spelling of the word "Example".
  11. Well then clearly there is something wrong with the way you've built it, but you haven't posted any code.
  12. Almost like Ajax? If you want only part of your page to update, then you need to be using Ajax.
  13. Give us a bit more information than that, internet stranger. Is your website live? Can we have a link?
  14. I'm sure there are thousands of tutorials on the web detailing website privileges. Using a search engine is something you learn how to do.
  15. Beeeeney

    Xbox!

    Any Xbox gamers here? Just got the new Forza yesterday! Post your gamertags.
  16. I'm not 100% sure how you'd go about doing it but I'm sure it involves sessions, cookies, writing to a database and then pulling the same information from the database next time, based on the cookie. That's how I'd do it, anyway. Edit: What they said ^
  17. Make it so that when someone submits the form, it remembers what was submitted so they don't have to enter it again next time. I think.
  18. Now it might be where I'm tired, but I literally have no idea what you're asking.
  19. Wouldn't that make you assume that the problem has been solved?
×
×
  • 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.