Guest Posted July 25, 2013 Share Posted July 25, 2013 (edited) Hello, I have an error with 1 part of code, $query = mysql_query ("SELECT * FROM news ORDER BY id DESC"); while($row = mysql_fetch_array($query)) { echo "<form action=update2.php method=get>"; echo "<tr>"; echo '<td><input type="hidden" name="id" value=' . $row["id"] . '> </td>'; echo "<div align='left'><table><td><input type='submit' name='update' value='update'" . " </td> </table>"; echo "</form>"; echo "<form action=news2.php method=post>"; echo "<td><input type='hidden' name='hidden' value='" . $row['headline'] . "'> </td>"; echo "<div align='center'><table><td><input type='submit' name='delete' value='delete'" . " </td> </table>"; echo "</form>"; echo "</tr>"; } in this part echo '<td><input type="hidden" name="id" value=' . $row["id"] . '> </td>'; the page update2.php gets not only the id. It looks like http://localhost/project1/News/update2.php?id=411%3E+%3C%2Ftd%3E%3Cdiv+align%3D&update=update and it should be only http://localhost/project1/News/update2.php?id=411 . Sorry for my bad English. Edited July 25, 2013 by AxelhacK Quote Link to comment Share on other sites More sharing options...
PravinS Posted July 25, 2013 Share Posted July 25, 2013 try replacing this line echo '<td><input type="hidden" name="id" value=' . $row["id"] . '> </td>'; with echo '<td><input type="hidden" name="id" value="'.$row["id"].'"></td>'; Quote Link to comment Share on other sites More sharing options...
Solution Guest Posted July 25, 2013 Solution Share Posted July 25, 2013 Thanks for the fast answer. I´ve allready solved it. Replaced the whole form with echo '<a href="update2.php?id='.$row['id'].'" target="_blank">edit</a>'; ~close please Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.