Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About zibrnp

  • Rank
  1. Hello, I have PHP file (file1.php) asking for a date: echo '<form action="charts.php" id="form_chart_date" method="post"> <div id="form_chart_date"> <p>Please select date. </p> <p><input name="date_looking" type="text"> <input type="submit" value="Display data" name="display_chart"></p> </div> </form>'; After submission file1.php handles the process but there is reference to JavaScript file which reads PHP generated JSON file. JavaScript file looks like: (document).ready(function() { var date = "<?php echo json_encode($
  2. Hello, I have a problem with a form I created. The form should load one row of fields (first name, last name and Date). When someone clicks on Date then jQuery date picker should display calendar. Until this point everything works perfectly ok. I also have a button that adds another row of the same fields (first name, last name and Date). The button adding new row works ok but calendar from jQuery date picker is not working in that newly added field. Can you guys take a look what might be wrong with my code please… Thanks, T $(document).ready(function(){ var x=0;
  3. Hello, I have small problem with script 13.1, particularly with step 5. Book explains that this code: $value = str_replace(array("\r", "\n", "%0a", "%0d"), ' ', $value); is going to create new value that is free of newline characters. It is true when I enter to the form string with "%0a" and "%0d" but it is not true for "\r" and "\n". When entering email "test@test.com\n" it creates "test@test.com\\n" (it adds backslash). Does anyone know why this is happening? Thanks for any suggestion.
  4. I am 100% sure I am looking at the correct cookie. No matter how I set expiration parameter it always says "Session". If I set expiration to time()+60 it actually expires after 60 seconds and I am not able to see restricted content. So it works but I do not see this value when I view cookie.
  5. Hello, I have been working on script 12.5. which allows to set cookie's parameters. As the example in the book shows, I wanted to set cookie that expires within 1h from creation. setcookie('user_id', $data['user_id'], time() + 3600, '/', '', 0, 0); When checking the cookie after successful signing-in, Expires: always says Session. Why is that? Thank
  6. OMG I can not believe I forgot that it returns array (the same mistake again) . Anyway thank you very much. T
  7. Hello I want to change value of a href label and need to reference it using class name. I did: <html> <head> <title>test</title> </head> <body> <a class="class_id" href="#">Older Post</a> </body> <script type="text/javascript"> window.onload = init; function init() { 'use strict'; var to_replace = document.getElementsByClassName('class_id'); to_replace.innerHTML = "Older"; } </script> </html> When using in html id and getElementById eve
  8. Thanks for the answer… Yes it does, It's described on page 245 of the book in "Functions as Variables Values" paragraph. Basically in this line "bidAjax.onreadystatechange = handleBidAjaxResponse;" we are assigning value of function "handleBidAjaxResponse" to the property "onreadystatechange" of the object bidAjax. Am I right? Thanks
  9. Hello, I'm going over the "view.js" file on page 585 and in point 12 we have: "bidAjax.onreadystatechange = handleBidAjaxResponse;" why "()" is missing in the function call? Why it is not like this: "bidAjax.onreadystatechange = handleBidAjaxResponse();" Thanks
  10. Hello, I have been working on a "quote" example, Chapter 11 page 468. I am using MAMP as local server environment. The example from the book was not working with "quote.php" file so I run the file via local server and blank page was returned. Any suggestion in regards to what I am doing wrong please? I have created "quote.json" file with exact content google's URL returns and that is working. Thanks, T
  11. Hello, I have been testing code on page 478 step 2 and don't understand why there is "error.message" instead of "ex.message"? try { ajax = new ActiveXObject('MSXML2.XMLHTTP.3.0'); } catch (ex) { console.log('Could not create the ActiveXObject: ' + error.message + '\n'); } Maybe the answer is simple but it bothers me a lot Could anyone help me understand it, please? Regards, T
  12. Hello, Thank you very mach for the explenation. Tom
  13. Hello Guys, I have been going over the book and wanted to do small exercise..., where I have form with three radio buttons and when clicking each one I am alerted (alert() method) with the value of the radio button. HTML markup looks like: <form action="#" method="post" id="theForm"> <fieldset><legend>Select Radio Button</legend> <div> <p> <input type="radio" name="options" id="a1" value="a1"> a1 <input type="radio" name="options" id="b2" value="b2"> b2 <input type="radio" name="options" id="c3" value="c3"> c3 </p> </div> &
  • Create New...