SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: editing form

  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    editing form

    please i am trying to make the variable $row['Pquantity'] editable, could you help look at the code.thanks
    PHP Code:
    <?
    $pplresult 
    mysql_query("SELECT * FROM repplac");
    echo 
    "<table border='1'><tr><th> SHOP NAME</th><th> PRODUCT NAME</th><th> PRODUCT SIZE</th><th> PRODUCT COLOUR</th><th> PRODUCT QUANTITY</th><th> PRICE</th><th> </th></tr>";
    while(
    $row mysql_fetch_assoc($pplresult)){?>
    <form action='youraccount.php' method='Post' class='slistbar'>
    <?echo "<tr><td>" .$row['Sname'] ."</td><td>" .$row['Pname'] ."</td><td>" .$row['Psize'] ."</td><td>" .$row['Pcolour'] ."</td><td>" .<input type='text' name='Pquantity' id='Pquantity' value='$row['Pquantity']' > ."</td><td>" .$row['Price'] ."</td><td>" ?>
    <a href="deleteproduct.php?del=<?php echo $row['Pidno'];?>">delete</a></td></tr><?php }
        
    // table closing tag
    echo"</table>"
    ?>
    </form>

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,398
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    And what is the problem?

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    its giving me a
    Parse error: syntax error, unexpected '<' in /home/reachea2/public_html/youraccount.php on line 119
    and also when i decided to echo the quantity alone and added the submit button, it was adding an empty row to the table

    PHP Code:
    <?
    $pplresult 
    mysql_query("SELECT * FROM repplac");
    echo 
    "<table border='1'><tr><th> SHOP NAME</th><th> PRODUCT NAME</th><th> PRODUCT SIZE</th><th> PRODUCT COLOUR</th><th> PRODUCT QUANTITY</th><th> PRICE</th><th> </th></tr>";
    while(
    $row mysql_fetch_assoc($pplresult)){?>
    <form action='youraccount.php' method='Post' class='slistbar'>
    <?echo "<tr><td>" .$row['Sname'] ."</td><td>" .$row['Pname'] ."</td><td>" .$row['Psize'] ."</td><td>" .$row['Pcolour'] ."</td><td>" .$row['Pquantity'] ."</td><td>" .$row['Price'] ."</td><td>" ?>
    <a href="deleteproduct.php?del=<?php echo $row['Pidno'];?>">delete</a></td></tr><?php }
        
    // table closing tag
    echo"</table>"
    ?>
    <div class='buttonarea'>
    <p>
    <input type='submit' name='submit' value='Add'>
    </p>
    </div>
    </form>

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,398
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    You got that error because you didn't put the string you added to the echo for the text field in quotes.

    And you might want to try to style that code a bit (indentation) to make it more readable. You're mixing up the order of opened and closed tags (table-form-/table-/form instead of table-form-/form-/table).

  5. #5
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    "You got that error because you didn't put the string you added to the echo for the text field in quotes."
    i am thinking the
    value='$row['Pquantity']'
    is in quote, or which string are you talking about

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,398
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    Code:
    <input type='text' name='Pquantity' id='Pquantity' value='$row['Pquantity']' >
    This whole part. You added it to the echo, but didn't put quotes around it. So the echo statement finds a < and doesn't know what to do with that.

  7. #7
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    thats working now, thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •