...

View Full Version : unexpected $end



jarv
05-15-2008, 08:54 AM
can someone please help with my error:


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




<?
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;

?>

jarv
05-15-2008, 09:21 AM
thanks now i get:
Parse error: syntax error, unexpected T_SL in display.php on line 24

RMcLeod
05-15-2008, 09:36 AM
As I stated before ensure there is no whitespace after EOF;

runnerjp
05-15-2008, 09:46 AM
<?php
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;

?>

syosoft
05-16-2008, 08:43 AM
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 require('protectpage.php'); ?>


<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>

barkermn01
05-16-2008, 09:22 AM
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

masterofollies
05-17-2008, 04:44 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum