computel Posted July 19, 2010 Share Posted July 19, 2010 Having problems storing 's from my php form to the database. here is the line that stores the review text. ContentText = '$_POST[review_text]', I tried this ContentText = '".mysql_real_escape_string($ContentText)."', but I don't see any text stored in the text box. What am I doing wrong? <? require_once("../conn.php"); require_once("../includes.php"); require_once("access.php"); require_once("AdminNavigation.php"); if(isset($_POST[s1])) { $q1 = "update games_content set ItemID = '$_POST[item_id_1]', ContentTitle = '$_POST[review_title]', ContentText = '$_POST[review_text]', rating = '$_POST[rating]' where ContentID = '$_GET[ContentID]' "; mysql_query($q1); if(!mysql_error()) { $message1 = "<br><span class=GreenLink>This review has been updated!</span>"; $message2 = "<a href=\"list_content.php?cmd=review&ItemID=$_GET[itemID]\" class=BlackLink>Back to reviews</a>"; } } //get the review info $q1 = "select * from games_content where ContentID = '$_GET[ContentID]' "; $r1 = mysql_query($q1) or die(mysql_error()); $a1 = mysql_fetch_array($r1); ?> <script> function AdminCheckAdd() { if(document.f1.item_id_1.value=="") { alert('Select a game, please!'); document.f1.item_id_1.focus(); return false; } if(document.f1.review_title.value=="") { alert('Enter the review title, please!'); document.f1.review_title.focus(); return false; } if(document.f1.review_text.value=="") { alert('Enter the review text, please!'); document.f1.review_text.focus(); return false; } } </script> <br> <form method=post name=f1 OnSubmit="return AdminCheckAdd();"> <table align=left width=450 cellpadding=0> <caption align=center class=BlackHeader>Edit this review<?=$message1?></caption> <tr> <td align=right>Game: </td> <td><?=select_item($a1[itemID], "item_id_1");?></td> </tr> <tr> <td align=right>Review Title:</td> <td><input type=text name="review_title" value="<?=$a1[ContentTitle]?>"></td> </tr> <tr> <td align=right valign=top>Add Gossip here:</td> <td><textarea name=review_text rows=4 cols=44><?=$a1[ContentText]?></textarea></td> <tr> <td align=right>Rate game:</td> <td><?=select_rating($a1[rating]);?></td> </tr> <tr> <td class=thead colspan=2 height=2></td> </tr> <tr> <td></td> <td><input type=submit name=s1 value="Submit"></td> </tr> <tr> <td colspan=2 align=center> <?=$message2?> </td> </tr> </table> </form> <? require_once("admin_footer.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/208198-having-problems-storing-s-from-my-php-form-to-the-database/ Share on other sites More sharing options...
computel Posted July 19, 2010 Author Share Posted July 19, 2010 I ment I tried like this ContentText = '".mysql_real_escape_string ($_POST[review_text])."', Quote Link to comment https://forums.phpfreaks.com/topic/208198-having-problems-storing-s-from-my-php-form-to-the-database/#findComment-1088228 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.