Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'validation'.

  • 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 9 results

  1. Hello, This chapter contains this tip: "One thing most beginner developers don’t realize is that it’s possible—in fact, quite easy—for a hacker to submit data to your PHP script without using your intended HTML form. For this reason, it’s important that you validate the existence of expected variables (i.e., that they are set), their type, and their values." I take it that the example presented in Script 6.7 demonstrated how to validate the fields? So that there would be no need to use the function isset in this particular case for example? Than you.
  2. I have a contact form on my site. I'm using the book's methods to validate POST data from a textarea input field called "contact_info". if ($_SERVER['REQUEST_METHOD'] == 'POST') { ... if (empty($_POST['contact_info'])) { $contact_errors['contact_info'] = 'Please enter a comment.'; } elseif (preg_match('/^[A-Za-z0-9.,-$?!]*$/', $_POST['contact_info'])) { $_POST['contact_info'] = str_replace(' ','',$_POST['contact_info']); //remove all spaces $_POST['contact_info'] = trim($_POST['contact_info']); //remove any space before or after any characters $_POST['contact_i
  3. Hello, I'm new to this forum thanks to a stupid problem I've been struggling with in the past couple of days. Now please keep in mind that I'm a newbie PHP dev, as in I'm working on a school project and sadly there's nobody who could give me a hand there. I need to warn you that my code uses the mysql functions, not mysqli or whatever else, since I'm using XAMPP and I don't really need to upgrade to the newest version. So, the problem is this: for some reason I can't seem to be able to validate my radio button group or my select field(drop down list). If I don't validate, will my d
  4. Hi. First off, this is in regards to exercise dealing with using a foreach loop instead of implode(). I was having trouble with it, and of course looked up what was posted here already, but I want to do more. By the I mean I wanted to validate that the form data was not empty, had no numbers, and had a minimum of five words that will of course be alphabetized(though I'd rather being doing some analysis with it for simple patterns like the avg number of characters by word, number of vowels, number of constants, but let me just be simple about it for now). Here's the code(just a note, to gi
  5. Larry, in your 4th edition of PHP and MySQL for Dynamic Web Sites, you use several times the FILTER_VALIDATE_INT filter with the filter_var() function in order to validate form input as positive integers (that is, natural numbers excluding zero, depending on whether you count zero as a natural number). To accomplish this you write in your book: filter_var($var, FILTER_VALIDATE_INT, array('min_range' => 1)) However, according to the PHP function reference, the third argument passed to the filter_var() function needs to be an associative array named $options. Inside this array yo
  6. Is there any way to validate a normal chtml text field(Chtml::textField declared without any model class) and display a message on he same page if the user leaves it blank and clicks a submit button. Here is the code <?php echo CHtml::beginForm(array('transaction/disp'),'Post'); ?> <div class="row"> <?php echo CHtml::label('Transaction Status','trst'); ?> </div> <div class="row"> <?php echo CHtml::textField('trst','',array('id'=>'trst','size'=>10)); ?> </div> <?php echo CHtml::submitButton('Submit', array('id'=>'submit','na
  7. My form validation refused to stop the submit event after acknowledging ‘alert’. This is the conclusion of the validation script: if (problem == 'No'){ return true; }else{ alert(alerts); return false; } After much trial and error, the following script does stop the 'submit' event: event.returnValue=false; This tip might help others. I don't recall seeing this solution in the book. I have no idea why it is needed but it is required with my script. Maybe there is some error or 'event bubbling' but I cannot find the error. My form is complex with several event listeners.
  8. 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
  9. 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...