Note that there are some explanatory texts on larger screens.

plurals
  1. PO$_POST variable not passing properly
    text
    copied!<p>So, I have 3 different web-pages that to passes variable to the next web-page.</p> <pre><code>session_start(); $_SESSION['transdate'] = $date_name; </code></pre> <p><strong>Next page:</strong></p> <pre><code>echo $_SESSION['transdate']; </code></pre> <p>Yes, I know session can be used to achieve the similar functionality. But, after trying the code above it says "Undefined variable: _SESSION". Yet, I made sure it has a proper name.</p> <p>So now I'm trying through $_POST, it's not showing undefined variable. But, it's not showing any results.</p> <h2>First form:</h2> <pre><code>$datePicker .= "&lt;input class='datepicker' type='text' name='datepicker'&gt;"; </code></pre> <p>The variable in the second form which was fetched from the first one is completely working.</p> <h2>Second form:</h2> <p><strong>PHP:</strong></p> <pre><code>$date_name $_POST['datepicker']; $date = $_POST['datepicker']; $date = date('Y-m-d: H:i:s', strtotime($date)); </code></pre> <p><strong>HTML:</strong></p> <pre><code>&lt;form action="inquiry.php" method="post"&gt; &lt;input name="schedule" type="hidden" value="&lt;?php echo $schedule; ?&gt;" /&gt; &lt;label&gt;&lt;font color="red"&gt;*&lt;/font&gt; Number of Kids:&lt;/label&gt; &lt;input name="kid" style="height:30px;" type="text" class="input-small" placeholder="Example: 1234567" pattern="[0-9]{1,11}" required /&gt; &lt;label&gt;&lt;font color="red"&gt;*&lt;/font&gt; Number of Adults:&lt;/label&gt; &lt;input name="adult" style="height:30px;" type="text" class="input-small" placeholder="Example: 1234567" pattern="[0-9]{1,11}" required /&gt; &lt;label&gt;&lt;font color="red"&gt;*&lt;/font&gt; Number of Rooms:&lt;/label&gt; &lt;input name="transdate" type="hidden" value="&lt;?php echo $date_name; ?&gt;" /&gt; &lt;select name="number_room"&gt; &lt;?php echo $availableRooms; ?&gt; &lt;/select&gt; &lt;label&gt;&lt;font color="red"&gt;*&lt;/font&gt; Number of Cottages:&lt;/label&gt; &lt;select name="number_cottages"&gt; &lt;?php echo $availableCottages; ?&gt; &lt;/select&gt; &lt;br /&gt; &lt;button type="submit" class="btn btn-success" style="text-align:center; margin-left: 0px; "&gt;Save Changes&lt;/button&gt; &lt;/form&gt; </code></pre> <p>While here the results are not showing.</p> <h2>Third Form</h2> <pre><code>$date = $_POST['transdate']; $date = date('Y-m-d: H:i:s', strtotime($date)); </code></pre> <p>EDIT: <a href="http://i.stack.imgur.com/ue1dR.jpg" rel="nofollow">Link to screenshot</a></p>
 

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