View Single Post
  #8 (permalink)  
Old 23-04-2008, 06:31 AM
skunkbad's Avatar
skunkbad skunkbad is offline
Experienced Member
 
Join Date: Apr 2008
Location: Temecula, California, USA
Posts: 118
Default

If there isn't a location in the database to store the data, then just make it. phpMyAdmin is really easy to use to add tables and associated fields to a MySQL database. If this is just a contact form, and the country field does not need to be stored, then just filter the country post variable value in your email processing script, and append it's value to whatever is sending the email.

As a php newbie, filtering data is one of the keys to being successful. Understanding validation and keeping your database, website, and emails safe is extremely important. Don't overlook this when adding the country field to your comment or contact form.

Here is an example of filtering data in a contact form in a php 5.2.0+ script:

PHP Code:
$name filter_input(INPUT_POST'name' FILTER_SANITIZE_STRING FILTER_FLAG_NO_ENCODE_QUOTES);
$email filter_input(INPUT_POST'email' FILTER_VALIDATE_EMAIL);
$mesg filter_input(INPUT_POST'mesg' FILTER_SANITIZE_STRINGFILTER_FLAG_NO_ENCODE_QUOTES); 
__________________
Brian's Web Design - Temecula

Last edited by skunkbad; 23-04-2008 at 06:35 AM.
Reply With Quote