Jump to content

[SOLVED] What is wrong with this syntax - small piece of code


938660

Recommended Posts

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/pipes/domains/pipes.pesladder.com/public_html/edit.php on line 545 ----line 545 is the 5th echo down.

 

 

echo "<form>";

echo "<fieldset>";

echo "<label>";

echo "<span><b>Title:</b></span>";

echo "<span class="price"><input name="title" type="text" id="title" value="<? echo $_SESSION['firstname']?>" size="24" />";

echo "</span>";

echo "</fieldset>";

echo "</form>";

 

echo "<form>";

echo "<fieldset>";

echo "<label>";

echo "<span>Title:</span>";

echo "<span class='price'><input name='title' type='text' id='title' value='" . $_SESSION['firstname'] . "' size='24' />";

echo "</span>";

echo "</fieldset>";

echo "</form>";

 

Of course to make it much simpler you could have written this like this:

<form>
<fieldset>
<label>
<span>Title:</span>
<span class="price"><input name="title" type="text" id="title" value="<? echo $_SESSION['firstname']?>" size="24" />
</span>
</fieldset>
</form>

 

In php everything must not be echoed. Everything that you want tot put out in php tags though must be. So simply use php tags only when you need them.

echo "<span class="price"><input name="title" type="text" id="title" value="<? echo $_SESSION['firstname']?>"[/u][/b] size="24" />";

 

 

The bold and underlined things are the problems.

Replace those double quotes " with single quotes '

 

And replace the PHP reinitialization/echo with simply putting the variable there without all that.

 

Here I fixed it for you just replace it with this;

echo "<span class='price'><input name='title' type='text' id='title' value='$_SESSION[firstname]' size='24' />";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.