PDA

View Full Version : Parse error: parse error, unexpected T_ECHO in ... on line 116


harlequin2k5
10-02-2006, 05:35 AM
Line 116 is...

<p>Name: <input type="text" name="name" value="<?php echo (isset($_POST['name'])) ? $_POST['name'] : echo $row['VendorName'] ?>" /></p>

I've tried several different things after googling and visiting php.net - but they lead to "?" errors and of course another error that I can't think of

if you need more code just lemme know - got a whole page of it *chuckles*

if anyone has any suggestions it would be greatly appreciated

_Aerospace_Eng_
10-02-2006, 05:43 AM
Try
<p>Name: <input type="text" name="name" value="<?php echo (isset($_POST['name'])) ? $_POST['name'] : $row['VendorName']; ?>" /></p>

If that doesn't work, we need to see the rest of your code.

harlequin2k5
10-02-2006, 05:53 AM
grrrr...once again I knew it was something easy

while it got rid of the error, the textbox remains empty...I'm wondering

does this form need to be echo'd inside of the <php> tags? afterall if it's outside of the tags then it can't read from the query right?

_Aerospace_Eng_
10-02-2006, 05:59 AM
Any php on the page goes together so yes it can read the query. You should echo that row by itself to see what is returned. You should echo $_POST['name'] as well. The way the ternary operator works is like this
(if this is true) ? do this : else do this;

harlequin2k5
10-02-2006, 06:11 AM
I echoed $row['VendorName'] and you know what it came up with? zip zilch nada...hmmm

ok well I think now I have a place to start...if not it's gonna have to wait until tomorrow - been on this page for 12 hours but unlike most days when I sit here like this - I've gotten quite alot accomplished *chuckles*

thanks aero!!

Brandoe85
10-02-2006, 03:06 PM
Check the scope of $row, make sure it's accessible from where you are echo'ing.

Good luck;