Jump to content

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


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' />";

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.