Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting Cookie in PHP Form Submit?
    primarykey
    data
    text
    <p>Here I have Situation to set the cookie after the form submitting into the same page.....</p> <p><strong>Here is the Code:</strong> </p> <pre><code>&lt;?php require_once 'config.php'; $dbHandle = DBHandler::getInstance(); @session_start(); if($_POST['division']) { $fromDiv =$_POST['division']; $divId =explode(',',$fromDiv); echo $divId[0].'~'; echo $_COOKIE['preDiv'].'dfg'.'&lt;br/&gt;'; setcookie("preDiv",$divId[0],time() + (10 * 365 * 24 * 60 * 60)); $_SESSION['division'] = $divId[0]; } $sql=$dbHandle-&gt;execQuery("SELECT * FROM master_division"); $division_str = '&lt;option value=""&gt;--select--&lt;/option&gt;'; while($fetch = $dbHandle-&gt;fetchObjectQuery($sql)) { $division = $fetch-&gt;division_id.','.$fetch-&gt;name; $division_str .= '&lt;option value="'.$division.'"&gt;'.$fetch-&gt;name.'&lt;/option&gt;'; } echo $_COOKIE['preDiv'].'dfg'.'&lt;br/&gt;'; echo $_SESSION['division']; ?&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body class="login" style="overflow: hidden;"&gt; &lt;div class="login-box" style="position: absolute;z-index: 999;padding: 10px;width: 40%;min-height: 200px;margin-left:-20%;"&gt; &lt;section class="portlet login-box-top" style="height:100%;"&gt; &lt;header&gt; &lt;h2 class="ac"&gt;CHOOSE DIVISION To MEDISMO CRM LOGIN&lt;/h2&gt; &lt;/header&gt; &lt;section style="height:76%;"&gt; &lt;div id="popup_box" &gt; &lt;!-- OUR PopupBox DIV--&gt; &lt;div id="group_comp" style="margin-top:15%;margin-left:20%;"&gt; &lt;form action="&lt;?php echo $_SERVER['PHP_SELF'];?&gt;" method="POST" style="border:none;"&gt; &lt;label&gt;&lt;b&gt;Choose Division:&lt;/b&gt;&lt;/label&gt; &lt;select id="division" name="division"&gt;&lt;?php echo $division_str;?&gt;&lt;/select&gt; &lt;input type="submit" id="ok" value="OK" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/section&gt; &lt;/section&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Anyone suggest me what is wrong in it...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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