Php syntax error,

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dominic600
Forum Newbie
Posts: 2
Joined: Fri Aug 05, 2011 6:32 pm

Php syntax error,

Post by dominic600 »

Okay so ive been working on this website and i made a register forum but when i ftp it and then go to test it out i get an error. ive done it exactly like in the video tutorial and it does not work for me.

heres the line of code to where its says im getting the error:
$form = <form action='register.php' method='post'>

and the error is :

Parse error: syntax error, unexpected '<' in /home/a3888506/public_html/register.php on line 7



Thanks for any help in advance,
Dominic
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Php syntax error,

Post by flying_circus »

That's because there is a syntax error. I would assume that you want to set the $form variable to the following string. You need to wrap it in quotes, so it is treated as a string, otherwise the < symbol is treated as a comparisson operator and dies.

Code: Select all

$form = "<form action='register.php' method='post'>";
dominic600
Forum Newbie
Posts: 2
Joined: Fri Aug 05, 2011 6:32 pm

Re: Php syntax error,

Post by dominic600 »

yes, i have done that. when i do that i get this :

Parse error: syntax error, unexpected '<' in /home/a3888506/public_html/register.php on line 8

and line 8 reads:
<table>
Dodon
Forum Commoner
Posts: 64
Joined: Wed Aug 03, 2011 4:11 am
Location: Netherlands

Re: Php syntax error,

Post by Dodon »

It's the same issue as you had before. You can't simply place <table> in your php code when <table> is html code. Either put it in a variable like you did with the form or use it as HTML code.
Post Reply