Bman900 Posted May 2, 2009 Share Posted May 2, 2009 Ok here is my include file(part of it): mysql_connect("db854.perfora.net", "dbo283875085", "XjT.WtgW") or die(mysql_error()); mysql_select_db("db283875085") or die(mysql_error()); $titleRes = mysql_query("SELECT title FROM site_title"); $title = mysql_result($titleRes, 0, 0); $aboutRes = mysql_query("SELECT about FROM about_title"); $about = mysql_result($aboutRes, 0, 0); Here is my form: <form id="form1" method="post" action="adminprocessgeneral.php"> <p align="center"> <label>Site Title: <input name="sitetitle" type="text" id="sitetitle" value="<?php echo "$title"; ?>" /> <br /> </label> <label> About Me: <textarea name="about" id="about" cols="45" rows="5"><?php echo "$about"; ?></textarea> </label> <input type="submit" name="submit2" id="submit2" value="Submit" /> </p> </form> Here is my processing file(part i need help with): mysql_connect("db854.perfora.net", "dbo283875085", "XjT.WtgW") or die(mysql_error()); mysql_select_db("db283875085") or die(mysql_error()); $newabout = $_POST['about']; $newtitle = $_POST['title']; mysql_query("UPDATE site_title SET title='$newtitle' WHERE title='$title'") or die(mysql_error()); mysql_query("UPDATE about_title SET about='$newabout' WHERE about='$about'") or die(mysql_error()); echo "Update succesfull! <br /> The about variable gets updated fine but the sitetitle just goes blank once I hit submit from my form. If I feed something directly in from phpmyadmin it shows up in the form in the $title variable fine. As soon as I hit that submit it erases it and doesn't put anything in. Whats wrong? Link to comment https://forums.phpfreaks.com/topic/156587-why-doesnt-it-work/ Share on other sites More sharing options...
Ken2k7 Posted May 2, 2009 Share Posted May 2, 2009 $title is not defined in your processing page? As with $about. Link to comment https://forums.phpfreaks.com/topic/156587-why-doesnt-it-work/#findComment-824475 Share on other sites More sharing options...
Bman900 Posted May 2, 2009 Author Share Posted May 2, 2009 $title is not defined in your processing page? As with $about. They are defined in my include and at the top of all my pages I have include("../include.php"); since am working in a folder. Link to comment https://forums.phpfreaks.com/topic/156587-why-doesnt-it-work/#findComment-824477 Share on other sites More sharing options...
Ken2k7 Posted May 2, 2009 Share Posted May 2, 2009 Do you get the right values when you echo out $newtitle, $newabout, $title and $about in the processing script? Link to comment https://forums.phpfreaks.com/topic/156587-why-doesnt-it-work/#findComment-824482 Share on other sites More sharing options...
Bman900 Posted May 2, 2009 Author Share Posted May 2, 2009 This is extremly weird, I just recreated it in a different page and now it works. But i do want to know why the other did not. I am going to echo out both variables before I process the info to see if they are available. Link to comment https://forums.phpfreaks.com/topic/156587-why-doesnt-it-work/#findComment-824485 Share on other sites More sharing options...
Bman900 Posted May 2, 2009 Author Share Posted May 2, 2009 Alright the problem it the varibable $newtitle does not print. I just need to fix it now. Link to comment https://forums.phpfreaks.com/topic/156587-why-doesnt-it-work/#findComment-824491 Share on other sites More sharing options...
Ken2k7 Posted May 2, 2009 Share Posted May 2, 2009 $title = $_POST['sitetitle']; Link to comment https://forums.phpfreaks.com/topic/156587-why-doesnt-it-work/#findComment-824502 Share on other sites More sharing options...
Bman900 Posted May 2, 2009 Author Share Posted May 2, 2009 Yep I just figure that out. Thanks! Link to comment https://forums.phpfreaks.com/topic/156587-why-doesnt-it-work/#findComment-824516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.