Jump to content

IF statement question from newbie...


tazdevil

Recommended Posts

Hi All

 

Please excuse my ignorance... I am a complete newbie to PHP and have a question.

 

The following code does a check on a form for the form contents.

 

What I want to do is add the following IF statement:

 

IF post_town = LONDON put LONDON into the county textarea box as well

 

I hope someone can help as I just can't figure this out.

 

thanks

 

<?php
// address sanity checks
$line1=ucwords(strtolower(substr(ereg_replace("[^A-Za-z0-9\. \-\,]", "", $line1),0,60)));
$line2=ucwords(strtolower(substr(ereg_replace("[^A-Za-z0-9\. \-\,]", "", $line2),0,60)));
$post_town=strtoupper(substr(ereg_replace("[^A-Za-z0-9\. \-\,]", "", $post_town),0,60));
$county=strtoupper(substr(ereg_replace("[^A-Za-z0-9\. \-\,]", "",  $county),0,60));
$postcode=strtoupper(substr(ereg_replace("[^A-Z0-9 ]", "", strtoupper($postcode)),0,10));
$allok=1;
if (strlen($line1)<2) { $allok=0;echo "<strong>Your street address is incorrect</strong><br />"; }
if (strlen($post_town)<2) { $allok=0;echo "<strong>Your post town/city is incorrect</strong><br />"; }
if (strlen($county)<2) { $allok=0;echo "<strong>Your county is incorrect</strong><br />"; }
if ((strlen($postcode)<4) || (strlen($postcode)>10)) { $allok=0;echo "<strong>Your postcode is incorrect</strong><br />"; }
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.