954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

$id = $_GET['id']; causing error

I have searched to try to find out what is going on and I can't seem to figure it out.

I am trying to follow an online tutorial for a simple rating system and am having trouble.

here is the code

<?php

include 'connect.php'

$id = $_GET['id'];

?>

<form action="rate.php" method="POST">
Choose rating 
<select name="rating">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>

<input type="hidden" name="id" value="<?php echo $id; ?>">

<p />

<input type="submit" name="submit" value="Rate">

</form>


Here is the error:

Parse error: syntax error, unexpected T_VARIABLE in /home/ahost307/public_html/domain.com/file/rate.php on line 5

any help. I am trying to pull data from my data base.

Thank you,

oddcarout
Newbie Poster
2 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

Add semicolon after include

include 'connect.php';
catherine sea
Junior Poster
126 posts since Jan 2008
Reputation Points: 25
Solved Threads: 20
 

Add semicolon after include

include 'connect.php';


Yep, that is it! Since PHP interprets semicolon as fullstop then line it will interpret as one line, so you are illegally trying to concatenate string and variable without a dot:

include 'connect.php' $id = $_GET['id'];
evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
 

Thanks, I had been looking and looking and totaly missed that.

oddcarout
Newbie Poster
2 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 
Thanks, I had been looking and looking and totaly missed that.


Are we solved yet?

evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You