blueman378 Posted February 4, 2008 Share Posted February 4, 2008 hi guys, well heres the entire code, <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Edit Comment</title> <style> .title { vertical-align:top; text-align:left; font-weight:bold; } </style> </head> <body bgcolor="#999999" style="font-size:16px; font-family:Arial;"> <? $idedit=$_GET['idedit']; include("connect.php"); @mysql_select_db("b13_1476306_my_db") or die("Unable to select database"); $out="SELECT * FROM comments WHERE id='$idedit'"; $output=mysql_query($out); mysql_close(); $id=mysql_result($output,$x,"id"); $name=mysql_result($output,$x,"name"); $email=mysql_result($output,$x,"email"); $comment=mysql_result($output,$x,"comment"); $date=mysql_result($output,$x,"date"); ?> <form method="post" action="commentsadminedit21.php"> <table> <input type="hidden" name="id_edit" size="40" disabled="disabled" <? echo "value=\"$id\""; ?>> <tr> <td class="title"> Name: </td> <td> <input type="text" name="name_edit" size="40" <? echo "value=\"$name\""; ?>> </td> </tr> <tr> <td class="title"> E-Mail Address: </td> <td> <input type="text" name="email_edit" size="40" <? echo "value=\"$email\""; ?>> </td> </tr> <tr> <td class="title"> Comment: </td> <td> <textarea name="comment_edit" cols="35" rows="6"><? echo $comment; ?></textarea> </td> </tr> <tr> <td class="title"> Date: </td> <td> <input type="text" name="date_edit" size="40" <? echo "value=\"$date\""; ?>> </td> </tr> <tr> <td> </td> <td align="center"> <input type="submit" value="Submit"> </td> </tr> </table> </form> <p> <? echo echo $_POST["id_edit"]; $id_edit=$_POST['id_edit']; $name_edit0=$_POST['name_edit']; $name_edit=filter_var($name_edit0, FILTER_SANITIZE_STRING); $email_edit0=$_POST['email_edit']; $email_edit=filter_var($email_edit0, FILTER_SANITIZE_STRING); $comment_edit0=$_POST['comment_edit']; $comment_edit=filter_var($comment_edit0, FILTER_SANITIZE_STRING); $date_edit0=$_POST['date_edit']; $date_edit=filter_var($date_edit0, FILTER_SANITIZE_STRING); if(isset($_POST['name_edit'])) { include("connect.php"); @mysql_select_db("b13_1476306_my_db") or die("Unable to select database"); $insert="UPDATE comments SET name='$name_edit', email='$email_edit', comment='$comment_edit', date='$date_edit' WHERE id='$id_edit'"; if (mysql_query($insert)) { die("SQL:<br>$insert"); } else { echo "<span class=\"alert\">Unable to edit comment.</span>"; } mysql_close(); } else { echo "Edit data that you wish to change and make sure that all the fields are filled. Then click Submit."; } ?> <p> <a href="http://rowno.byethost13.com/commentsadmin22.php">Back to main comments page</a> </body> </html> but when it is run using a link such as http://rowno.byethost13.com/commentsadminedit21.php?idedit=12 we get UPDATE comments SET name='Roland Warmerdam', email='rolandwarmerdam@hotmail.com', comment='Test', date='04/02/2008 09:39 am' WHERE id='' notice that where is empty any ideas why it is not being recoreded? Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/ Share on other sites More sharing options...
blueman378 Posted February 4, 2008 Author Share Posted February 4, 2008 names and email are imaginary!! Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/#findComment-457493 Share on other sites More sharing options...
pdkv2 Posted February 4, 2008 Share Posted February 4, 2008 check the line <form method="post" action="commentsadminedit21.php?idedit=$idedit"> Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/#findComment-457496 Share on other sites More sharing options...
blueman378 Posted February 5, 2008 Author Share Posted February 5, 2008 whats wrong with it? Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/#findComment-458339 Share on other sites More sharing options...
pdkv2 Posted February 5, 2008 Share Posted February 5, 2008 This form tag is taken as such from the HTML view source. $idedit is printed as such Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/#findComment-458346 Share on other sites More sharing options...
blueman378 Posted February 5, 2008 Author Share Posted February 5, 2008 oh right, well any ideas on how to fix it? Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/#findComment-458374 Share on other sites More sharing options...
Aureole Posted February 5, 2008 Share Posted February 5, 2008 Uhh... <form method="post" action="commentsadminedit21.php?idedit=<?php echo( $idedit ); ?>"> Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/#findComment-458380 Share on other sites More sharing options...
blueman378 Posted February 5, 2008 Author Share Posted February 5, 2008 hmm... thats what happens when you work on things at 3 am lol thanks Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/#findComment-458470 Share on other sites More sharing options...
Aureole Posted February 5, 2008 Share Posted February 5, 2008 I know what you mean, I always make stupid mistakes at stupid times. It's 7:33 AM and I've been coding since like 11 PM... Quote Link to comment https://forums.phpfreaks.com/topic/89343-solved-variable-getting-erased/#findComment-458471 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.