Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6790865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:46:38+00:00 2026-05-26T17:46:38+00:00

Using the following script to send info to a flatfile and it works until

  • 0

Using the following script to send info to a flatfile and it works until the introduction of the validation. Getting a Parse error at the brace { on line 23.
What is the likely cause of the breakage ?

<?php
    // we must never forget to start the session
    session_start();
    ?>
    <html>
    <head>
    <title>Form to Flat File</title>
    </head>
    <body>
    <?php
    $vname = $_GET["visitor"];
    $vemail = $_GET["visitormail"];
    $vphone = $_GET["visitorphone"];
    $ip = $_SERVER['REMOTE_ADDR'];
    $httpref = $_SERVER['HTTP_REFERER'];
    $httpagent = $_SERVER['HTTP_USER_AGENT'];
    $todayis = date("l, F j, Y, g:i a") ;

    // VALIDATION INTRODUCTION - THESE ARE THE FORM FIELDS THAT WE REQUIRED THE VISITOR TO FILL IN  
        if(empty($vname) 
        || empty($vemail) 
        || empty($vphone) 
        {      //Parse error: parse error in C:\wamp\www\Poll\DRBPoll\RaffleInfo.php on line 23
        echo "<h2>Go Back and fill in all fields  </h2>\n";
        echo '<a href="javascript:history.go(-1)"><h3>Go Back to the Raffle Form</h3></a><br />';    /*GO BACK BUTTON*/
        die ("Use the Go Back to Raffle Form button !! ");
        }
        if(!$vemail == "" && (!strstr($vemail,"@") || !strstr($vemail,"."))) 
        {
        echo "<h2>Go Back and enter a valid E-mail Address</h2>\n";
        echo '<a href="javascript:history.go(-1)"><h3>Go Back to the Raffle Form</h3></a><br />';    /*GO BACK BUTTON*/
        die ("Use the Go Back to Raffle Form button !!");   
        }

    // THANK YOU MESSAGE IS WORKING

    print("<b>Thank You!</b><br />Your information will be entered once into the raffle!");
    $out = fopen("savedinfo.php", "a");
    if (!$out) {
    print("Could not add detail to Raffle file! Please contact the Webmaster");
    exit;
    }
    //OUTPUTS TO THE FLATFILE IS WORKING
    fputs ($out, "\n");
    fwrite($out,"$todayis [IST], $vname, $vemail, $vphone, $ip, $httpref, $httpagent.");
    fclose($out);
    ?>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:46:38+00:00Added an answer on May 26, 2026 at 5:46 pm

    You forgot to close the parenthesis you opened next to if.

    Replace:

        if(empty($vname)
        || empty($vemail)
        || empty($vphone)
    

    with:

        if(empty($vname)
        || empty($vemail)
        || empty($vphone))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following script to send mail <? extract($_POST); $subject = Feedback
I'm using the following jQuery script to send a 'Make' parameter to filter my
I am using the following javascript for form validation: <script type=text/javascript> function validate_form (
I'm building some <table> data dynamically using jQuery, but I'm getting the following error:
I'm using the following code to send POST request if validation passes. But it
I'm using the following script in my website in order to create pagination next-previous
I'm using the following script to request new content to a file called index.html:
I'm using the following script to force a specific page - when loaded for
I have Divs show and hide (with an animation) using the following script (I
Ok, I have been using the following script for over a year now to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.