velocite Posted April 15, 2008 Share Posted April 15, 2008 Hi again I have two problems: 1. How can i set the location so its a folder below 2. Once executed the page displays an empty screen <?php //Start session session_start(); //Setting variable for the input values $title_input = $_POST['title']; $body_input = $_POST['bodytext']; $id = $_POST['id']; $docroot = $_SERVER['DOCUMENT_ROOT']; //Including neccessary files to connect to database include( '../connect.php'); include( '../config/config.php'); if (!isset($_POST['title'])) { header('Location: ' . $docroot . '/test/test4.php'); $_SESSION['edit_msg'] = '<font color=red>Please fill in the fields</font>'; } if (!isset($_POST['bodytext'])) { header('Location: ' . $docroot . '/test/test4.php'); $_SESSION['edit_msg'] = '<font color=red>Please fill in the fields</font>'; } //Selecting the Database mysql_select_db('mycms', $dbconnect); //Add the inputted content into the database //"UPDATE example SET age='22' WHERE age='21'" mysql_query ( $edittitle = "UPDATE news SET news_title='$title_input' WHERE news_id='$id'" ) or die("MySQL Error:\nMySQL Returned: ".mysql_error()); mysql_query ( $editbody = "UPDATE news SET news_body='$body_input' WHERE news_id='$id'" )or die("MySQL Error:\nMySQL Returned: ".mysql_error()); //If statement about displaying error message if (!$edittitle || !$editbody) { //If unsuccessful, force cancel the operation and display error message $_SESSION['edit_msg'] = die('Adding the news failed ' . mysql_error()); header('Location: ' . $docroot . '/test/test4.php'); } else { $_SESSION['edit_msg'] = '<font color=green>Adding the news was successful</font><br /><br />'; header('Location: ' . $docroot . '/test/test4.php'); } ?> Please help Link to comment https://forums.phpfreaks.com/topic/101177-edit-news-script/ Share on other sites More sharing options...
conker87 Posted April 15, 2008 Share Posted April 15, 2008 1: What location? 2: You don't seem to be outputting anything. Link to comment https://forums.phpfreaks.com/topic/101177-edit-news-script/#findComment-517533 Share on other sites More sharing options...
velocite Posted April 15, 2008 Author Share Posted April 15, 2008 1: What location? 2: You don't seem to be outputting anything. 1. folder/script the bold is where the script is located and the location should be a page called 'test4.php' in the previous folder called 'folder' 2. the output is meant to be in the form of a session message. 3. As an additional question, how the heck do you stop a <?php echo $_SESSION['session_name']; ?> being display before its actually set. Link to comment https://forums.phpfreaks.com/topic/101177-edit-news-script/#findComment-517540 Share on other sites More sharing options...
conker87 Posted April 15, 2008 Share Posted April 15, 2008 1: Try adding an extra "/../" after the docroot variable. 2: Make sure you have session_start(); on that page too. 3: <?php if (isset($_SESSION['session_name'])) { // do stuff cuz it's set } else { // it's not set } ?> Link to comment https://forums.phpfreaks.com/topic/101177-edit-news-script/#findComment-517546 Share on other sites More sharing options...
velocite Posted April 15, 2008 Author Share Posted April 15, 2008 Still doesnt work, it still displays a blank white page... Link to comment https://forums.phpfreaks.com/topic/101177-edit-news-script/#findComment-517556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.