Need help with required fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • quyhurry
    First Sergeant

    • Nov 2005
    • 76

    Need help with required fields

    Hi all,
    I made this form using Pablo's way:

    and the acknowledge php page:

    Everything works fine.

    Now i wanted to validate required fields and made 3 more errors pages:




    And try this script, using navaldesign's way:
    <?php
    @$Name = addslashes($_POST['Name']);
    @$Email = addslashes($_POST['Email']);
    @$Essay = addslashes($_POST['Essay']);
    if (strlen($Name) >40)
    {
    header("Location: error_name.html");
    exit;
    }
    if (strlen($Name) == 0 )
    {
    header("Location: error_name.html");
    exit;
    }
    if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $Email))
    {
    header("Location: error_email.html");
    exit;
    }
    if (strlen($Email) == 0 )
    {
    header("Location: error_email.html");
    exit;
    }
    if (strlen($Essay) == 0 )
    {
    header("Location: error_essay.html");
    exit;
    }
    $pfw_header = "From: $Email\n"
    . "Reply-To: $Email\n";
    $pfw_subject = "Data Submitted from Webform";
    $pfw_email_to = "duyanhvq@nguyenthaihocfoundation.com";
    $pfw_message = "Name: $Name\n"
    . "Email: $Email\n"
    . "Essay: $Essay\n"
    *****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
    header("Location: ack.php");
    ?>

    I put the script inside body tag of ack.php and replaced the former one.
    It didn't work and got the message:
    Parse error: parse error, unexpected '@' in /home/nguyent/public_html/ack.php on line 60

    What did i do wrong? Please help. Thank you so much.
    Quy
  • quyhurry
    First Sergeant

    • Nov 2005
    • 76

    #2
    Re: Need help with required fields

    I 'VE GOT IT !!!!
    My errors were:
    -. "Essay: $Essay\n" --> missed a ; at the end of the line
    -header("Location: ack.php"); --> totally wrong .
    I made a confirmation page and change to :
    header("Location: confirmation.html");

    I figured it out but breaking down the required fileds to ONE and did some testings

    Comment

    • mark d
      Private

      • Jun 2006
      • 1

      #3
      Re: Need help with required fields

      I need a php script for required email fields. I would like a user to fill out required fields, click submit and I receive the required field information via email. After clicking the submit button the user is served a "thank you" page with information on it. Does anyone have a script? Thank you!

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #4
        Re: Need help with required fields

        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment

        Working...
        X