Guest Posted July 25, 2013 Share Posted July 25, 2013 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. Link to comment https://forums.phpfreaks.com/topic/280493-get-form-errror/ 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>'; Link to comment https://forums.phpfreaks.com/topic/280493-get-form-errror/#findComment-1442076 Share on other sites More sharing options...
Guest Posted July 25, 2013 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 Link to comment https://forums.phpfreaks.com/topic/280493-get-form-errror/#findComment-1442077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.