Check Left 4 characters of Form Variable
| From: | vernon | Date: | Mon, 18 Nov 2002 19:48:57 +0000 |
| Subject: | Check Left 4 characters of Form Variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-124967@lists.php.net to get a copy of this message | ||
I have a form that is acting like an email page where there Subject is being
submitted from one page to another and tagging the subject with "RE: ". I
want to be able tack the RE: on but only if it doesn't already have it
there. I know that I can use and if statement, but how to I check the left 4
characters:
<?php
if ($HTTP_POST_VARS['subject'] == "RE: ") {
echo "<input name='subject' type='text' id='subject2'
value='<?php echo
$HTTP_POST_VARS['subject']; ?>'"
} else {
echo "<input name='subject' type='text' id='subject2'
value='RE: <?php echo
$HTTP_POST_VARS['subject']; ?>'"
}
?>
Thanks