Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Another PHP question!

  • 04-04-2005 01:29PM
    #1
    Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭


    New to PHP and I am trying to print out a form, with multiple checkboxes. I have successfully used PHP to run options in a drop down menu. However I am still having problems in print to the screen any kind of form through php.

    print "<tr>
    <td>
    <input type="submit" name="Delete" value="Submit" />
    </td>
    <td>
    <b>Product ID</b>
    </td>
    <td>
    <b>Name</b>
    </td>
    <td>
    <b>Description</b>
    </td>
    <td>
    <b>Picture</b>
    </td>
    <td>
    <b>Category</b>
    </td>
    <td>
    <b>Supplier</b>
    </td>
    <td>
    <b>AdminID</b>
    </td>
    </tr>";

    if($r = mysql_query($query)){
    while($row = mysql_fetch_array($r)){

    print "<tr>
    <td><input type="checkbox" name="delete[{$row}]" value="{$row}" />
    </td>
    <td>{$row}</td>
    <td>{$row}</td>
    <td>{$row}</td>
    <td>{$row}</td>
    <td>{$row}</td>
    <td>{$row}</td>
    <td>{$row}</td>
    </tr>";

    The form and table opening tags lie outside the php code. I have seperated the code for easy reading.


Comments

  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    What happens when you run it?


  • Moderators, Politics Moderators, Paid Member Posts: 44,040 Mod ✭✭✭✭Seth Brundle


    print "<tr>
    <td><input type="checkbox" name="delete[{$row['ProductID']}]" value="{$row...
    
    you say that you have stripped some of the tags etc. but are you sure that before stripping you have not accidentally left it like it is above - where the quotes in type="checkbox" isn't escaped into type=\"checkbox\"


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    Parse error: parse error, unexpected T_STRING in /hsphere/local/home/madraci/mad-racing.com/delete.php on line 23


    BLA BLA BLA going insance :D

    Line 23 = the first print statement. If I take away the form tag complete in both print statement the table run fine.


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    you say that you have stripped some of the tags etc. but are you sure that before stripping you have not accidentally left it like it is above - where the quotes in type="checkbox" isn't escaped into type=\"checkbox\"

    Thank you! It always the simple things. :D


Advertisement