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
https://forums.phpfreaks.com/topic/88193-if-statement-question-from-newbie/
Share on other sites

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.