95 users online (1 members and 94 guests)  




  Results 1 to 2 of 2
Digg button stumble

Related

  1. required fields in a form    Forum: HTML Forum
    Replies: 17
  2. HTML Form with required fields    Forum: HTML Forum
    Replies: 10
  3. Required Form Fields    Forum: Javascript Forum
    Replies: 1
  4. Replies: 3
  1. #1
    ohmadevo's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2008
    Posts
    2

    required form fields in php page using redirect.php form

    Hi from a new member~
    I want to require all form fields in a php membership registration page. I've tried javascripts in the <head></head> and appropriate labels in the <body>, but the redirect.php in the form command overrides them, apparently, because if I type nothing in the form fields but a password (required by the redirect.php), it processes it. I saw somewhere on this site (can't find it now) that suggested using this code:
    <?php
    if ($form1 && $form2 && $form3) {
    echo "Thank you for submitting your form";
    } else {
    echo "You have not filled out all the required fields. Place hit your back button and fill out all the required fields.";
    }
    ?>
    But do I put that in the <head></head> section and what do "form 1" etc. refer to? Elements of the form? Or would it be better to put all the required elements in the redirect.php file? If so, can you give me an example of how to do one (such as firstname)?

    One last question, please: If I fail to fill out the password, I get a popup error, but the page I'm left on is blank. I am not taken back to the register.php page. What is causing that?
    Thank you SOooo much!



  2. #2
    ohmadevo's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2008
    Posts
    2

    Re: required form fields in php page using redirect.php form

    Sorry to confuse; the page is html, not php. It's the php script in the form that is causing the problem for me:
    <FORM METHOD="POST" ACTION="register.php">
    That script seems to override my javascript in the <head></head> of my page, and I've tried 2 different jscripts. The php still takes over and moves me on w/o verifying the form fields. Is that clearer?



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •