Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: unexpected $end

  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    unexpected $end

    can someone please help with my error:


    Parse error: syntax error, unexpected $end in /Users/avertstaff/Sites/johns/test/post.php


    Code:
    <?
    require('protectpage.php');
    
    $output = <<<EOF
    <form action="insert.php" method="post">
    Firstname: session_register("myusername");
    <br>
    Lastname: 
    <input type="text" name="lastname" />
    <br>
    Age: 
    <input name="age" type="text" size="2" />
    <br>
    <select>
    <option value="Page to be modified" selected="selected">Page to be modified</option>
    <option value=""></option>
    <option value="aafrica.htm">aafrica.htm</option>
    <option value="abc-hiv.htm">abc-hiv.htm</option>
    <option value="about.htm">about.htm</option>
    </select>
    <br>
    <input type="submit" />
    <br>
    <a href="display.php">display</a>
    </form>
    </body>
    </html>
    EOF; 
    echo $output;
    
    ?>

  • #2
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    thanks now i get:
    Parse error: syntax error, unexpected T_SL in display.php on line 24

  • #3
    New Coder
    Join Date
    Mar 2008
    Location
    Somerset, England
    Posts
    93
    Thanks
    0
    Thanked 10 Times in 10 Posts
    As I stated before ensure there is no whitespace after EOF;

  • #4
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    PHP Code:
    <?php
    require('protectpage.php');
    $output = <<<EOF;
    <
    form action="insert.php" method="post">
    Firstnamesession_register("myusername");
    <
    br>
    Lastname
    <
    input type="text" name="lastname" />
    <
    br>
    Age
    <
    input name="age" type="text" size="2" />
    <
    br>
    <
    select>
    <
    option value="Page to be modified" selected="selected">Page to be modified</option>
    <
    option value=""></option>
    <
    option value="aafrica.htm">aafrica.htm</option>
    <
    option value="abc-hiv.htm">abc-hiv.htm</option>
    <
    option value="about.htm">about.htm</option>
    </
    select>
    <
    br>
    <
    input type="submit" />
    <
    br>
    <
    a href="display.php">display</a>
    </
    form>
    </
    body>
    </
    html>
    EOF
    echo 
    $output;

    ?>

  • Users who have thanked runnerjp for this post:

    jarv (05-15-2008)

  • #5
    Regular Coder
    Join Date
    Sep 2006
    Location
    Vermont, USA
    Posts
    154
    Thanks
    0
    Thanked 6 Times in 6 Posts
    Seems a bit silly to put that whole page in a php block... especially when you're only using 1 variable in the string...

    PHP Code:
    <?php require('protectpage.php'); ?>
    Code:
    <form action="insert.php" method="post">
    Firstname: <?php echo $_SESSION['myusername']; ?>
    <br>
    Lastname: 
    <input type="text" name="lastname" />
    <br>
    Age: 
    <input name="age" type="text" size="2" />
    <br>
    <select>
    <option value="Page to be modified" selected="selected">Page to be modified</option>
    <option value=""></option>
    <option value="aafrica.htm">aafrica.htm</option>
    <option value="abc-hiv.htm">abc-hiv.htm</option>
    <option value="about.htm">about.htm</option>
    </select>
    <br>
    <input type="submit" />
    <br>
    <a href="display.php">display</a>
    </form>
    </body>
    </html>
    Active PHP/MySQL application developer available for immediate work.
    syosoft.com mavieo.com - Remote Web Site Administration Suite - Reseller Ready

  • #6
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    unexspected $end

    Meens that there is a (,{,[ left open some ware

    so have a properlook and count your (,{,[ and make sure you end them all

    Also when calling php

    <? - this is not a proper php call <?php or <?=$this?> then one you are using is for you to output the value of a var into HTML it is not supposed to run the full script

  • #7
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    Parse error: syntax error, unexpected $end in /Users/avertstaff/Sites/johns/test/post.php

    Means

    You need to add one more } to your script. (Or more then one depending on how many you have open) but it's usually only one.


  •  

    Posting Permissions

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