Web Analytics Made Easy -
StatCounter Parse error: parse error, unexpected T_ECHO in ... on line 116 - CodingForum

Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parse error: parse error, unexpected T_ECHO in ... on line 116

    Line 116 is...

    PHP Code:
    <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

  • #2
    Try
    PHP Code:
    <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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

    Comment


    • #3
      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?

      Comment


      • #4
        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
        PHP Code:
        (if this is true) ? do this : else do this
        ||||If you are getting paid to do a job, don't ask for help on it!||||

        Comment


        • #5
          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!!

          Comment


          • #6
            Check the scope of $row, make sure it's accessible from where you are echo'ing.

            Good luck;
            -Brando
            Why using tables for eating is stupid!

            Comment

            Working...
            X