Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'forms'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 12 results

  1. I'm used to using $_POST to handle my form data. In chapter 2, Mr Ullman states to use $_REQUEST. I did look up $_REQUEST on php.net and it says that it contains data for $_GET, $_POST, and $_COOKIE. Does that mean I no longer need to bother with $_GET or $_POST and just use $_REQUEST going forward? Sorry for the amateur question. I've done some PHP programming in the past and I'm trying to get back into it (hopefully in the correct way). Thank, James
  2. I probably have some kind of visual/spacial related learning disability. I know that a form sends data to the server where php processes it and outputs it to the browser. Words alone don't always work for me. I have to draw things as if I were trying to explain it to someone else. Some times that helps me to see that my logic simply doesn't compute. Thought I was good to go with arrays... $var = array('dog', 'cat', '2', 'blue'); $var now contains all the values in the array. But, in the book, the syntax (using post) is: $title = $_POST['title']; $name= $_POST['name']; $email= $_POST['email']; To this newb it appears that the array concept has been abandoned for a multi-variable "device". I realize it's my inability to grasp it. (Tried to post the drawing but got "that extension not allowed" with png, gif, jpg. Finally gave up and put in a link instead) My drawing shows what I think happens. (I like to think I--at least-- have that much right.) But it still seems clunky. Would like to get a grip on this and share with other seniors (dob: 12-7-45). http://chattanoogacentral1964.com/drawing.php
  3. Hello, This is a beginner's question regarding the "creating errors messages" (pp 381) and the "putting it all together" (pp 415). I'd appreciate if someone could clarify some of the code. In page 318, in the HTML after the paragraph "With that HTML, elem.parentNode refers to the DIV, so appending a new child results in: ..." 1) Shouldn't the span in this HTML have a class = 'error', which was assigned in step 4 ? 2) Why do we need to add a class = 'error' to the span and to the label anyway? I am assuming it is for changing the CSS but I don't see it used in the "Putting it all together" code of page 415. In page 415-420, "Putting it all together": 1) Why do we need the class = "two" in each DIV ? 2) How the CSS was manipulated to change the labels with error to red color. Thank you very much for your help.
  4. Hi there. I'm just having some trouble with the chapter 10 forms 'putting it all together' task. I created the register.js file as guided by the book, which has validation using regular expressions. However, when I load the form in a browser, and try to create some errors by incorrectly filling it in, I just get the generic HTML5 error messages, which say "Please fill out this field". I want the form to validate dynamically using the validateForm() function inside of register.js, not the standard HTML '<required>' validation. How can I make my form use these regular expression validations to give me the 'inline' errors using <span> which the book refers to on page 415, as opposed to the HTML5 errors? My code appears to be identical to the book, so I won't put my code in here unless it's necessary? Thanks
  5. On the view_users.php page, when you click on the "Edit" link you are redirected to another page using the user_id being passed to next page within the URL. On page 260 we are told of the first method in which uses the hidden input type for forms, how can we apply this method to the "Edit" link hyperlink and what adjustments would need to be made to the view_users.php script to allow this ?
  6. Hello there! The thread referenced (at the bottom) covers how to display two forms on a single page. However . . . In the case referenced, both forms are visible on the page by default, and it is only *after* a submit has been detected that the script detects the form sent, and calls the appropriate code. It seems possible to display only one of the forms based on a user's site visit status. For example, assume a page contains code for both 'Form A' and 'Form B'. What I'm looking for is: 1) When the user visits the page for the first time, 'Form A' is displayed by default, then; 2) On any subsequent visit to the page by the same user, during the same session, 'Form B' is displayed by default. Of course, the submit still gets handled by the processing script, but that's already been covered in the thread referenced. What's got me snookered is how to determe the visitors status (i.e., new or return visit) so that the appropriate form can be displayed. ~ David Reference: http://www.larryullman.com/forums/index.php?/topic/1362-two-forms-on-one-page/
  7. Page 108, version 0.5 The following sentence seems to jump over several points, each of which needs a more detailed explanation. Consequently, I cannot understand this sentence at all: "the form used to both create and edit a record is its own file, and that file can be included by both create.php and update.php (those two files start by changing the headings above the form)." Larry, can you break this down please? Thanks.
  8. Hello, I have been trying to get my form to validate the radio button which allows my user to agree to the terms and conditions, however, it either prints at the top of the page or not at all. The other prompts print near the form input which is what I would like to happen for the radio button. Following is my code. if (isset($_POST['radio_Agree'])) { $Agree = mysqli_real_escape_string($connect, $_POST['Agree']); } else { $reg_errors['radio'] = 'Please agree to the user Terms and Conditions.'; } <p><label> <input type="radio" name="Agree" value="Agree" /></label> <a name="Agree" id="Agree"></a>I agree to the user Terms and Conditions.<br /> <?php create_form_input('radio', 'Agree', $reg_errors); ?></p>
  9. Hello, I have been wrestling with textareas in one way or another for quite some time. I would like to add a text area within the Edit User form however, when I update the information from the data base does not appear in the text area. The information does appear in the other fields. This is the last piece of code that I tested: <p><strong>Description:</strong></p> <textarea name="description" rows="5" cols="40" value="' . $row[7] . '" /> </textarea></p> Thanks Marie
  10. I am going through chapter 10 and I have run into a problem with focus and blur events on multiple form elements. I have a function which adds multiple events and handlers to elements. function addPlaceholderHandlers(elem) { 'use strict'; elem.onfocus = setOpacity; elem.onkeydown = removePlaceholder; elem.onblur = addPlaceholder; } // end of addPlaceholderHandlers function Then I run the following code in window.onload window.onload = function() { 'use strict'; var elements = document.getElementById('caseEval').childNodes; for (var i = 0, count = elements.length; i < count; i++) { var element = elements[i]; addPlaceholderHandlers(element); } }; The onkeydown is the only code that actually runs, and I suspect that this is so because the focus and blur events do not bubble. The obvious solution is to use the addEventHandler and set the phase to true to "capture" the event, however, I am not aware that IE has an equivalent for phase. Aside from referencing each individual element, adding the event to each element, and then setting an event handler for each individual element, is there a better alternative for selecting multiple elements when using the focus and blur?or should I change my event handlers to something other then: function removePlaceholder(evt) { 'use strict'; // get reference to the event if (!evt) evt = window.evt; // element triggering the event var target = evt.target || evt.srcElement; if (target.value === target.defaultValue) { target.value = ''; } target.style.color = '#000'; } // end of removePlaceholder function I would just like to add that I absolutely love this book and the support in this forum. I have never done any programming until three or so weeks ago, and I didn't even know what HTML was just a few weeks prior to that. I feel that this book is so well written, concise in its examples, and relevant that it should be in every beginners and maybe some intermediate programmer's bookshelf. You have definitely gained a lifelong reader.
  11. First off, what a well written technical book! Thanks Larry. I'm working on a project that currently uses JavaScript validation. The page will have PHP functionality later, but after reading chapter 6's validation examples, I got to thinking . . . Can I have slicker AJAX style same page validation using PHP? This would put the error messages in the same page after form field completion but before submission. I saw an example elsewhere that essentially points the action to the same page, but it used a lot of "include" scripting. The validation scripting in the book is so simple, yet the JavaScript currently being used in my project seems so unnecessarily clunky. So, in short, what is the easiest way to augment the validation example in the book for same page validation? Would it be more efficient than AJAX validation?
  12. Great book. In the form examples throughout the book you recommend combining the form and validation and checking to see if the form has been submitted by using - if ($_SERVER['REQUEST_METHOD'] == 'POST') When I try that I get error messages telling me that the variables haven't been defined yet. That's because the form hasn't been submitted yet! I thought you said that the server function would just be empty if there was nothing to request (ie. before submission)? Am I missing something? Thanks, Arnie
×
×
  • Create New...