Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-15-2008, 08:54 AM   PM User | #1
jarv
Banned

 
Join Date: Mar 2007
Posts: 1,523
Thanks: 116
Thanked 0 Times in 0 Posts
jarv can only hope to improve
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;

?>
jarv is offline   Reply With Quote
Old 05-15-2008, 09:21 AM   PM User | #2
jarv
Banned

 
Join Date: Mar 2007
Posts: 1,523
Thanks: 116
Thanked 0 Times in 0 Posts
jarv can only hope to improve
thanks now i get:
Parse error: syntax error, unexpected T_SL in display.php on line 24
jarv is offline   Reply With Quote
Old 05-15-2008, 09:36 AM   PM User | #3
RMcLeod
New Coder

 
Join Date: Mar 2008
Location: Somerset, England
Posts: 93
Thanks: 0
Thanked 10 Times in 10 Posts
RMcLeod is an unknown quantity at this point
As I stated before ensure there is no whitespace after EOF;
RMcLeod is offline   Reply With Quote
Old 05-15-2008, 09:46 AM   PM User | #4
runnerjp
Regular Coder

 
Join Date: Nov 2006
Posts: 601
Thanks: 1
Thanked 2 Times in 2 Posts
runnerjp can only hope to improve
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;

?>
runnerjp is offline   Reply With Quote
Users who have thanked runnerjp for this post:
jarv (05-15-2008)
Old 05-16-2008, 08:43 AM   PM User | #5
syosoft
Regular Coder

 
Join Date: Sep 2006
Location: Vermont, USA
Posts: 154
Thanks: 0
Thanked 6 Times in 6 Posts
syosoft is an unknown quantity at this point
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
syosoft is offline   Reply With Quote
Old 05-16-2008, 09:22 AM   PM User | #6
barkermn01
Regular Coder

 
Join Date: Nov 2007
Location: Leeds, UK
Posts: 514
Thanks: 24
Thanked 19 Times in 19 Posts
barkermn01 can only hope to improve
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
barkermn01 is offline   Reply With Quote
Old 05-17-2008, 04:44 AM   PM User | #7
masterofollies
Senior Coder

 
Join Date: May 2005
Posts: 2,137
Thanks: 96
Thanked 72 Times in 72 Posts
masterofollies can only hope to improve
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.
masterofollies is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:54 PM.


Advertisement
Log in to turn off these ads.