fluidsharp Posted May 6, 2011 Share Posted May 6, 2011 Hi all, I have two issue with script. 1. It works in PhpEd and with apache but doesn't work at remote server with apache. Error is well known - "Warning: Cannot modify header information - headers already sent " 2. when I added more than 20 records like $var = $_POST['var']; it stops work local. Error is same. adminka_wrapp.php <?php $addFormatName = $_POST['addFormatName']; $addFormatDes = $_POST['addFormatDes']; $page = $_GET['page']; if (isset($addFormatName) && isset($addFormatDes)) { $page = 'add_formats'; } else if ($page == NULL) { $page = "user_access_log"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="../style/adminkaview.css"> </head> <body> <div class="col-wrap1"> <div class="col-wrap2"> <div class="col1"> <div class="content" id="c1"> <p><a href="?page=view_add_format">Format and extensions</a></p> </div> </div> <div class="col2"> <div class="content" id="c2"> <?php require("$page.php");?> </div> </div> <div class="clear"></div> </div> </div> </body> </html> view_add_format.php <?php require_once "../function.php"; $q = connect("SELECT `formats`.* FROM `xxx`.`formats` "); echo "<form method='post' action='adminka_wrapp.php'> <table> <tr> <td>id</td> <td>Formats Name</td> <td>Description</td> </tr>"; while($rowResult = $q->fetch_assoc()) { echo "<tr>"; $id = $rowResult["id"]; $formatName = $rowResult["f_name"]; $description = $rowResult["description"]; echo "<td>".$id."</td>" ."<td>".$formatName."</td>" ."<td>".$description."</td>"; echo "</tr>"; } echo " <tr> <td> <input type='submit' value='AddFormat' name='submitAddFormat'> </td> <td> <input type='text' name='addFormatName' maxlength='20' size='5'> </td> <td> <input type='text' name='addFormatDes' maxlength='20' size='5'> </td> "; echo "</table> </form>"; ?> add_formats.php <?php require "../function.php"; if (isset($addFormatName) && isset($addFormatDes) ) { $q = connect("INSERT INTO `xxx`.`formats` (`id` ,`f_name` ,`description` ) VALUE (NULL ,'$addFormatName' ,'$addFormatDes' ) "); header("Location: adminka_wrapp.php?page=view_add_format"); exit(); } ?> function.php <?php function connect($query) { $db = new mysqli('127.0.0.1', 'xxx', 'xxx', 'xxx'); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $result = $db->query($query); $db->close(); return $result; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/235676-script-runs-local-but-remote-doesnt/ Share on other sites More sharing options...
Adam Posted May 6, 2011 Share Posted May 6, 2011 Take a look at the sticky on this board: HEADER ERRORS - READ HERE BEFORE POSTING THEM Quote Link to comment https://forums.phpfreaks.com/topic/235676-script-runs-local-but-remote-doesnt/#findComment-1211480 Share on other sites More sharing options...
MadTechie Posted May 6, 2011 Share Posted May 6, 2011 the file thats causing the error is "check add_formats.php" see link in post above for more info Quote Link to comment https://forums.phpfreaks.com/topic/235676-script-runs-local-but-remote-doesnt/#findComment-1211484 Share on other sites More sharing options...
fluidsharp Posted May 7, 2011 Author Share Posted May 7, 2011 I've read it before posting, but not all was clear for me. I moved code from add_formats.php to adminka_wrapp.php and it works on remote server. Is there others ways to solve this issue? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/235676-script-runs-local-but-remote-doesnt/#findComment-1211888 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.