Jump to content

ensuring all text feilds contain date


burge124

Recommended Posts

first, use the isset() function on the submit button to check if the submit was submitted (returns TRUE/FALSE).

next use the empty() function to check if a filed was left empty (returns TRUE/FALSE).

if any thing was empty display the page again. otherwise save the info, and use a header to go to the next page.

You can never trust the user so testing in your script is the right thing to do.  However, if the option is available, do your users a favor and include that check on the client side as well before the GET/POST is submitted. 

 

 

if you decide to use the empty function, you may want to replace all the spaces to check and make sure the user didn't just enter in a lot of spaces.

 

<?php 
$testString = str_replace(" ",""$string); // don't save this just use it to check stuff.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.