Jump to content
Larry Ullman's Book Forums

hugo

Members
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About hugo

  • Rank
    Newbie
  1. It works now: I was missing the method. Thanks for catching that mistake Hartley. However, it was strange-all my scripts, not just the one I posted was spitting out only the PHP source code. My scripts work now although I have no idea what I did. I tried shutting off and turning back on XAMPP and also made sure to use Save As in Notepad++; perhaps these steps helped? I don't know. I'm so glad the scripts are working now, phew!
  2. Yeah, I just tried typing in http://localhost/script_03_01.html into my browser, then I filled out the form and got this output: Notice: Undefined index: title in C:\xampp\htdocs\handle_form.php on line 15 Notice: Undefined index: name in C:\xampp\htdocs\handle_form.php on line 16 Notice: Undefined index: response in C:\xampp\htdocs\handle_form.php on line 17 Notice: Undefined index: comments in C:\xampp\htdocs\handle_form.php on line 18 Thank you, , for your comments. You stated that you found this example to be '' and added: I'm kinda confused now: Am I supposed to open the HTM
  3. Hi Hartley, Yes I ran php_info(); and all the information is shown neatly in a long grid. I'm still stumped as to why the php output is like that. I double clicked the HTML form which opens in Mozilla, then I filled in the form and pressed the submit button. The php output that returns is strange. Can you please help?
  4. For some reason XAMPP Apache is no longer working--it was working before. To be sure, I downloaded Larry's HTML and PHP scripts (from OReilly Website) and tested them; and the output I received in my browser was: Thank you, $title $name, for your comments. You stated that you found this example to be '$response' and added: $comments "; ?> The HTML file downloaded is Script_03_01.html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
  5. Sorry, Larry it was my mistake. I should have checked the errata before posting. I've been so captivated to learn from your book that I had not considered the errata! Thanks, I understand now.
  6. I'm still having difficulty understanding this. On pg 136, the text says that the statement: if (!isset($_POST['terms'])) { could be written more exact by changing it to: if (!isset($_POST['terms']) AND ($_POST['terms']=='Yes')) { Question: Is the bolded segment a typo? Instead, should the statement be written as: if (!isset($_POST['terms']) AND ($_POST['terms'] !='Yes') { error message.... That way, if the person filling the form does not check the box, both these conditions become TRUE in order to trigger the error message? Your help is appreciated. Thank
  7. Thank you very much! The code works now. Can you recommend a good source of reading on proper and/or non-sloppy code formatting? I've found several sources online after running a google search, but am not sure which one to trust. Your advice is highly appreciated. Thanks in advance.
  8. I'm having trouble with the following javascript code: function process() { 'use strict'; var okay=true; var email = document.getElementById('email'); var comments=document.getElementById('comments'); if(!email || !email.value || (email.value.length < 6) || (email.value.indexOf('@')= = -1)) { okay=false; alert('Please enter a valid email address'); } if(!comments || !comments.value || (comments.value.indexOf('<') != -1)) { okay=false; alert('Please enter your comments without any HTML!'); }
  9. Hey Hartley, can you please help me understand why years.value is a string value? I thought years.value is by default a number object because of this line of code in the html document: <div> <label for="years">Years</label> <input type="number" name="years" id="years" min="1" required> </div> It says input type="number" which I have assumed the digits entered by the person filling the webform to be a number object. Why is this a string value? Can you refer me to further reading or help explain it? I am new to programming so any explanation you are
  10. I also wish to add that I changed the code to: function calculate() { 'use strict'; var cost; var type=document.getElementById('type'); var years=document.getElementById('years'); if(type && type.value && years && (years.value>0)) { switch(type.value){ case 'basic': cost=10.00; break; case 'premium': cost=15.00; break; case 'gold': cost=20.00; break; case 'platinum': cost
  11. Thank you very much! I think I understand now.
  12. Hello fellow programmers: I need help with Step #5 (page 147): if (type && type.value && years && (years>0)) { Question: When I replace years >0 with years.value >0, the program crashes--returns the please enter valid values message. Why doesn't this work? FYI: Step #3: var years = document.getElementById('years'); Thanks in advance.
  13. Hello Larry and other forum users, I have trouble understanding the code on page 136: if (!isset($_POST['terms']) AND ($_POST['terms']=='Yes')) { print '<p class="error">You must agree to the terms.</p>'; $okay=FALSE; } Question(s): 1. Why do I need to include ($_POST['terms'] =='Yes' ? 2. If i only include this code in the document: if ($_POST['terms'] !='Yes') { etc. } then i get the error message in my Mozilla browser: Notice: Undefined index: terms in C:\xampp\htdocs\handle_reg.php on line 76 The code in red still prints out, but this stran
×
×
  • Create New...