Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Warning: Cannot modify header information - headers already sent by" error
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/8028957/headers-already-sent-by-php">Headers already sent by PHP</a> </p> </blockquote> <p>i keep receiving this error each time i try to submit the a form deletion form.</p> <blockquote> <p>Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\speedycms\deleteclient.php:47) in C:\xampp\htdocs\speedycms\deleteclient.php on line 106</p> </blockquote> <p>is there something wrong with my code? what do i need to change to make it work?</p> <pre><code>&lt;?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = ""; $MM_donotCheckaccess = "true"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") &amp;&amp; true) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "login.php"; if (!((isset($_SESSION['MM_Username'])) &amp;&amp; (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&amp;"; if (isset($QUERY_STRING) &amp;&amp; strlen($QUERY_STRING) &gt; 0) $MM_referrer .= "?" . $QUERY_STRING; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?&gt; &lt;?php require_once('Connections/speedycms.php'); $client_id = mysql_real_escape_string($_GET['id']); $con = mysql_connect($hostname_speedycms, $username_speedycms, $password_speedycms); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("speedycms") or die(mysql_error()); ?&gt; &lt;?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION &lt; 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } if ((isset($_GET['id'])) &amp;&amp; ($_GET['id'] != "") &amp;&amp; (isset($_POST['deleteForm']))) { $deleteSQL = sprintf("DELETE FROM tbl_accident WHERE id=%s", GetSQLValueString($_GET['id'], "int")); mysql_select_db($database_speedycms, $speedycms); $Result1 = mysql_query($deleteSQL, $speedycms) or die(mysql_error()); $deleteGoTo = "progress.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&amp;" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } mysql_select_db($database_speedycms, $speedycms); $query_delete = "SELECT * FROM tbl_accident WHERE id=$client_id"; $delete = mysql_query($query_delete, $speedycms) or die(mysql_error()); $row_delete = mysql_fetch_assoc($delete); $totalRows_delete = mysql_num_rows($delete); ?&gt; &lt;p class="form2"&gt;Are you sure you wish to &lt;b&gt;delete&lt;/b&gt; the record for &lt;?php echo $row_delete['clientName']; ?&gt;?&lt;/p&gt; &lt;form name="form" method="POST" action="&lt;?php echo $deleteAction; ?&gt;"&gt; &lt;p class="form2"&gt;&lt;input type="submit" value="Yes" /&gt; &lt;input name="no" type="button" id="no" value="No" /&gt; &lt;/p&gt; &lt;input type="hidden" name="deleteForm" value="form" /&gt; &lt;/form&gt; </code></pre> <p>thanking you in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload