Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP if, else statement. Form and date of birth validation
    primarykey
    data
    text
    <p>Im writing code practicing PHP <strong>if and else statements</strong> and <strong>form validation</strong>.</p> <p>the basic idea is this: After entering name, <strong>DOB</strong> , and email and clicking the submit button, <strong>Based on the DOB they enter</strong> the button leads them to leads to:</p> <p>-a page telling them they are too young to drink <strong>(notwelcome.php)</strong></p> <p><strong>OR</strong></p> <p>-a page telling them they can order a drink <strong>(welcome.php)</strong></p> <p>The 2 pages <strong>(notwelcome.php &amp; welcome.php)</strong> are pulled from separate file called <strong>action.php</strong> saved like this:</p> <pre><code>&lt;?php include('welcome.php'); include('notwelcome.php'); ?&gt; </code></pre> <p>This is what i have been trying ..but its not working. nothing happens.. Its as if the if else code isnt even there :(</p> <pre><code>&lt;?php if ($_POST['submit']) { $dob = $_POST['dob']; if (isset ($_POST['dob'] )&gt; 12/31/1992) { header("Location: notwelcome.php"); } else { header("Location: welcome.php");} } ?&gt; </code></pre> <p>Help. Im a beginner and i have hit a small bump in the road in my code.</p> <p>additional infor:</p> <p>HTML Code is like this:</p> <p></p> <pre><code> &lt;div style="text-align: center;"&gt; &lt;h2&gt;FORM &amp; PHP&lt;/h2&gt; &lt;h3&gt;WHINE &amp; DINE&lt;/h3&gt; &lt;form action="action.php" method="post"&gt; Full Name: &lt;input type="text" name="name"&gt;&lt;br&gt; Date of Birth: &lt;input type="date" name="dob"&gt;&lt;br&gt; E-mail: &lt;input type="text" name="email"&gt;&lt;br&gt; &lt;input type="submit" data-inline="true" value="Submit"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre>
    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