dezkit Posted March 1, 2009 Share Posted March 1, 2009 I have 2 problems: 1. I don't see what I have in the database echo'd in the textarea 2. When I submit the form, the database won't get updated. <?php if($_POST["action"]=="true"){ $tbl_name="site"; $edit=$_POST["edit"]; $description=$_POST["description"]; $sql="UPDATE $tbl_name SET field='$field', description='$description"; $result=mysql_query($sql); if($result){ echo "The $field page has been saved."; echo "<br>"; echo "<a href='./admin'>Back to admin page</a> <a href='./$field'>View $edit page</a>"; } else { echo "ERROR"; } mysql_close(); } else { $field=$_GET["field"]; $sql="SELECT * FROM $tbl_name WHERE field='$field'"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ echo '<form name="form" method="post" action="admin.php?edit='.$_GET["field"].'&action=true">'; echo '<textarea rows="10" cols="70" name="description" value="'.$rows["description"].'"></textarea>'; echo '<input type="submit" name="submit" value="submit"></form>'; } }?> Thanks guys. Quote Link to comment https://forums.phpfreaks.com/topic/147457-why-doesnt-this-script-work/ Share on other sites More sharing options...
dezkit Posted March 1, 2009 Author Share Posted March 1, 2009 Bump before I go out, thanks in advance guys! Quote Link to comment https://forums.phpfreaks.com/topic/147457-why-doesnt-this-script-work/#findComment-774015 Share on other sites More sharing options...
Mad Mick Posted March 1, 2009 Share Posted March 1, 2009 Looks like you're mixing your POSTs and GETs. action="admin.php?edit='.$_GET["field"].'&action=true will create two GET variables 'edit' and 'action' but you are checking for $_POST['action'] and $_POST['edit'] Quote Link to comment https://forums.phpfreaks.com/topic/147457-why-doesnt-this-script-work/#findComment-774025 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.