Jump to content

aub

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by aub

  1. You forgot to close phpURL tag?
  2. aub

    Validation

    I need to validate first name, last name, street, suburb, postcode, email, status and date of birth. I tried to do this validation but gave me heaps of error and I messed up more. This is my full PHP/MySQL code: For easy view, click the link below. http://codepaste.net/3usepx Your help would be greatly appreciated! Thank you.
  3. aub

    Please help...

    Yes I've tried and couldn't find it :s
  4. aub

    Please help...

    Your help would be appreciated! Thanks!
  5. Design a form that accept your first name, last name and email address. Use GET for posting the form into the same php page, print out the result: (first_name, last_name, and email_address after the form is being submitted, you must validate your first_name, last_name are alphabetic, and your email address is valid. Also all fields must be mandatory. I don't know how to make first name and last name alphabetic and email address valid. This is my code: <html xmlns='http://www.w3.org/1999/xhtml'> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> <title>PHP Scripting</title> </head> <body> <h1>TASK 3: Question 4</h1> <?php if (isset($_GET['Submit'])) { echo "inside the form". $_GET['Submit'] . "<br>"; $firstname = $_GET['fname']; $lastname = $_GET['lname']; $DOB = $_GET['dob']; if(empty($_GET['fname']) || empty($_GET['lname']) || empty($_GET['dob'])) { echo 'Please fill in all of the fields.'; } else { $firstname = $_GET['fname']; $lastname = $_GET['lname']; $dob = $_GET['dob']; if(ucfirst($firstname) != $firstname || ucfirst($lastname) != $lastname) { echo 'The first letter of your first and last name must be in upper case.'; } else { echo 'Thank you ' . htmlspecialchars($firstname) . ' ' . htmlspecialchars($lastname) . ', for entering your date of birth: ' . htmlspecialchars($dob) . '<br />'; } } } else { ?> <form action="getform.php", method="get"> <p>First Name: <input type="text" name="fname" value=""/></p> <p>Last Name: <input type="text" name="lname" value=""/></p> <p>DOB: <input type="date" name="dob" value=""/></p> <p><input type="submit" name="Submit" value="Submitted"/></p> <?php echo "not in form yet"; echo "<br>" . $_SERVER['PHP_SELF']; } ?>
  6. Oh my friggin god! What the hell? How embarrassing! Thanks for the help! Really appreciate it.
  7. Hi guys, just need your tiny help. I'm learning as you can see. The question says: Create a script to check if the value "Sydney" is stored in the following array (hint: use function: in_array) $cities = array("New York", "London", "Sydney", "Paris", "Brisbane") (Note: you must print the ending result) This is my code: <?php $cities = array("New York", "London", "Sydney", "Paris", "Brisbane") if (in_array("Sydney", $cities)) { echo "Yes, Sydney is stored!"; } ?> I cant fix the problem? Your help would be lovely. Thanks!
  8. Never mind, it works now :S Any mod can close this thread. Cheers! <3
  9. I did but where's the time settings? :S
  10. Hi guys, this forum says Time Now: Apr 27 2014 06:14 AM on the bottom of the page but in Australia where I live right now, it's 4:17pm so how do I change this forum time? Thanks!
  11. For some reason, when I click the button "Submitted", the error came up "Object not found!" but I believe my php still works? Thanks! EDIT: Forgot to say this; can you let me know if it works or not. Thanks again
  12. I dont have a code. I just dont know how :S
  13. Yes, that's what I mean And thanks for correcting my topic title!
  14. Hi guys, this is my very first post and thread as you can see. At TAFE, I'm doing Certificate IV and we started learning how to code in php. It's pretty fun, to be honest! I have 3 questions and I just need your help if you don't mind or if you're bored/free. _____________________________________________________________ Having the following students table: 1. Convert the table into an array (Linear array) 2. Convert the array into associative array 3. Use list function to print the SID, and NAME, i.e key and value _____________________________________________________________ Your help would be greatly appreciated! Thanks.
×
×
  • 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.