Jump to content
Larry Ullman's Book Forums

phpdvpr

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by phpdvpr

  1. Oops sorry, I just realized I had skipped over the explanation about saving the file with the php extension. I suppose that should have been obvious that I can't run php in an html file. It works as a php file. On the bright side, I probably won't make that mistake again.
  2. Hi Larry, I am working through the sections on for loops and I just want to make sure the code did what it was supposed to do. In Script 6.9 the highlighted section at the end of page 153 and the beginning of page 154 you write a for loop for a drop down box. The section of code is shown below is written in the file named register.html: <select name="day"> <option value="">Day</option> <?php for ($i = 1; $i <= 31; $i++) { print "<option value=\"$i\">$i</option>\n"; } ?> </select> However, when I view the source code after loading the html file, I don't get what you got. The for loop did not appear to work. I've looked at it a number of times and can't seem to find the error. Source Code below: <div><p>Please complete this form to register:</p></div> <form action="handle_reg.php" method="post"> <p>Email Address: <input type="text" name="email" size="30"></p> <p>Password: <input type="password" name="password" size="20"></p> <p>Confirm Password: <input type="password" name="confirm" size="20"></p> <p>Date of Birth: <select name="month"> <option value="">Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="day"> <option value="">Day</option> <?php for ($i = 1; $i <= 31; $i++) { print "<option value=\"$i\">$i</option>\n"; } ?> </select> <input type="text" name="year" value="YYYY" size="4"></p> I am running windows 10, PHP 7.1.9
  3. Hi Larry, I was going through the end of chapter questions for Chapter 4. The second bullet point asks why the following code won't work? print "The total is $$total"; However when I run that code it does work, by which I mean it prints out "The total is 10" when $total = 10. I am running windows 10, PHP 7.1.9
×
×
  • Create New...