php programme is not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bce7097
    New Member
    • Oct 2009
    • 2

    php programme is not working

    i am trying to retrive the data from client
    the programme is html page
    Code:
    <HTML>
    <HEAD></HEAD>
    <BODY>
    <FORM METHOD=POST ACTION="check.php">
    Have you ever eaten haggis before?
    <INPUT NAME="Choice1" TYPE="Checkbox" VALUE="Haggis">
    <BR>
    Have you ever eaten snails before?
    <INPUT NAME="Choice2" TYPE="Checkbox" VALUE="Snails">
    <BR>
    Have you ever eaten locusts before?
    <INPUT NAME="Choice3" TYPE="Checkbox" VALUE="Locusts">
    <BR>
    <BR>
    <INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>
    and save the file as check.html

    Code:
    <HTML>
    <HEAD></HEAD>
    <BODY>
    <?php
    echo "$Choice1"<BR>;
    echo "$Choice2"<BR>;
    echo "$Choice3"<BR>;
    
    ?>
    </BODY>
    </HTML>
    and saved as check.php


    but it is always showing the error as
    Parse error: parse error in C:\wamp\www\dee raj\check.php on line 5
    so pl..can any help me...
    Last edited by Dormilich; Oct 27 '09, 06:50 AM. Reason: please use [code] tags when posting code
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    In check.php. You did no retrieved the value using $_POST.

    Code:
    $choice1 = $_POST['Choice1']; 
    $choice2 = $_POST['Choice2'];
    $choice3 = $_POST['Choice3'];
    
    echo $choice1;
    echo "<br>";
    echo $choice2;
    echo "<br>";
    echo $choice3;
    echo "<br>";
    Use this link for reference PHP Manual

    Regards
    Dheeraj Joshi
    Last edited by Dormilich; Oct 27 '09, 06:53 AM. Reason: removed unnecessary quote

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      Originally posted by dheerajjoshim
      Code:
      echo $choice1;
      echo "<br>";
      echo $choice2;
      echo "<br>";
      echo $choice3;
      echo "<br>";
      or taking the shortcut
      Code:
      echo $choice1, "<br>", $choice2, "<br>", $choice3, "<br>";

      Comment

      • Dheeraj Joshi
        Recognized Expert Top Contributor
        • Jul 2009
        • 1129

        #4
        Originally posted by Dormilich
        or taking the shortcut
        Code:
        echo $choice1, "<br>", $choice2, "<br>", $choice3, "<br>";
        Smart... I like it

        Regards
        Dheeraj Joshi

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          Originally posted by dheerajjoshim
          Smart...
          reading the manual actually pays off.

          Comment

          • Dheeraj Joshi
            Recognized Expert Top Contributor
            • Jul 2009
            • 1129

            #6
            Reading manual helps a lot...

            Regards
            Dheeraj Joshi

            Comment

            Working...