runnerjp Posted May 30, 2008 Share Posted May 30, 2008 just this ismple post will not work :S is my code wrong or is it some other issue it does not take me to the if (isset($_POST["edit"])) { part <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css"> <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/members/include/style.css"> <?php error_reporting(E_ALL); require_once '../settings.php'; checkLogin ('1'); $id=$_GET['id']; $query = "SELECT * FROM forumtutorial_posts where postid='$id'"; if ($result = mysql_query($query)){ if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $title = $array['title']; ?> <?php if (isset($_POST["edit"])) { $title = $_POST['title']; echo "Your title is ". $title . "<br />"; echo "Thank you for ordering from Tizag Art Supplies!"; } else { ?> <h4>test</h4> <form action='<?php "$_SERVER[php_SELF]" ?>' method="post"> Title: <input name="title" type="text" value="<?php echo $title;?>" /> <input type="submit" value="edit"/> </form> </body></html> <?php }}}?> Link to comment https://forums.phpfreaks.com/topic/107970-simple-post-will-not-work/ Share on other sites More sharing options...
saint959 Posted May 30, 2008 Share Posted May 30, 2008 hey, here is what i would do off the top of my head: in place of your if statement where you check if the form is posted: <?php if ($_POST['title'] != "") { $title = $_POST['title']; echo "Your title is ". $title . "<br />"; echo "Thank you for ordering from Tizag Art Supplies!"; } else { ?> Link to comment https://forums.phpfreaks.com/topic/107970-simple-post-will-not-work/#findComment-553369 Share on other sites More sharing options...
runnerjp Posted May 30, 2008 Author Share Posted May 30, 2008 hey thank but it gives me Undefined index: title in /home/runningp/public_html/members/include/editforum.php on line 19 if ($_POST['title'] != "") { Link to comment https://forums.phpfreaks.com/topic/107970-simple-post-will-not-work/#findComment-553373 Share on other sites More sharing options...
saint959 Posted May 30, 2008 Share Posted May 30, 2008 Hey can you try this and see what it gives you: <?php error_reporting(E_ALL); require_once '../settings.php'; checkLogin ('1'); $id=$_GET['id']; $query = "SELECT * FROM forumtutorial_posts where postid='$id'"; if ($result = mysql_query($query))] { if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $title = $array['title']; if ($_POST['title_field'] != "") { echo "Your title is ". $_POST['title_field'] . "<br />"; echo "Thank you for ordering from Tizag Art Supplies!"; } else { ?> <h4>test</h4> <form action="<?php "$_SERVER[php_SELF]" ?>" method="post"> Title: <input name="title_field" type="text" value="<?php echo $title;?>" /> <input type="submit" value="edit"/> </form> </body> </html> <?php } } } ?> Link to comment https://forums.phpfreaks.com/topic/107970-simple-post-will-not-work/#findComment-553376 Share on other sites More sharing options...
runnerjp Posted May 30, 2008 Author Share Posted May 30, 2008 humm get Notice: Undefined index: title_field in /home/runningp/public_html/members/include/editforum.php on line 16 Link to comment https://forums.phpfreaks.com/topic/107970-simple-post-will-not-work/#findComment-553379 Share on other sites More sharing options...
tapos Posted May 30, 2008 Share Posted May 30, 2008 try this <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css"> <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/members/include/style.css"> <?php error_reporting(E_ALL); require_once '../settings.php'; checkLogin ('1'); $id=$_GET['id']; $query = "SELECT * FROM forumtutorial_posts where postid='$id'"; if ($result = mysql_query($query)){ if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $title = $array['title']; ?> <?php if (isset($_POST["edit"])) { $title = $_POST['title']; echo "Your title is ". $title . "<br />"; echo "Thank you for ordering from Tizag Art Supplies!"; } else { ?> <h4>test</h4> <form action='<?php "$_SERVER[php_SELF]" ?>' method="post"> Title: <input name="title" type="text" value="<?php echo $title;?>" /> <input type="submit" name="edit" value="edit"/> </form> </body></html> <?php }}}?> u can't get a html form element after form posting without giving a name to that element. Link to comment https://forums.phpfreaks.com/topic/107970-simple-post-will-not-work/#findComment-553380 Share on other sites More sharing options...
runnerjp Posted May 30, 2008 Author Share Posted May 30, 2008 ahh yes now i see... ty thats where i have been going wrong!!! Link to comment https://forums.phpfreaks.com/topic/107970-simple-post-will-not-work/#findComment-553385 Share on other sites More sharing options...
runnerjp Posted May 30, 2008 Author Share Posted May 30, 2008 that worked thanks...you couldnot help me out with this little bit..i havent comes across doing this before if i have <input type="checkbox" name="locked"> Locked so can i insert the value 1 into my db im colum locked if its checked?? Link to comment https://forums.phpfreaks.com/topic/107970-simple-post-will-not-work/#findComment-553390 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.