Jump to content

check for symbol in text field before $_POST


avo

Recommended Posts

HI All

Is it possible for you to let me know how to check for a symbol in a text field before a post
i thought i should use a wildcard and tryed

[code]<?

if ($_POST ['email'] !=@% ) {
$no_symbol = "bad;
} else {

$no_symbol = "good;
}

?>[/code]

but i was wrong only came up with errors

if someone can point me in the direction of the variable that i need to use i will it will be most appriciated..

Thank in advance.
[!--quoteo(post=369046:date=Apr 26 2006, 03:18 PM:name=avo)--][div class=\'quotetop\']QUOTE(avo @ Apr 26 2006, 03:18 PM) [snapback]369046[/snapback][/div][div class=\'quotemain\'][!--quotec--]
HI All

Is it possible for you to let me know how to check for a symbol in a text field before a post
i thought i should use a wildcard and tryed

[code]<?

if ($_POST ['email'] !=@% ) {
$no_symbol = "bad;
} else {

$no_symbol = "good;
}

?>[/code]

but i was wrong only came up with errors

if someone can point me in the direction of the variable that i need to use i will it will be most appriciated..

Thank in advance.
[/quote]

You could do it using regular expressions and look for the @ character. I'm not good at them but I am sure someone else could enlighten both of us how to look for the @ symbol.
HI

Just tryed the code
but it assigns the variable to bad regardless if the @ symbols is pressent or not

[code]//check if email text filed as @ symbol pressent
if (strpos($_POST['email'], '@') !== false) {
$frm_check_email  = "good";
}
else {
$frm_check_email = "bad";
$frm_check = "bad";
}[/code]

hope you can help again

thanks.
Thanks Barand for you help .

I was getting confused i left it for last night came back this morning to it and relised i was trying to capture a text filed that did not exsist i was looking for [code]$_POST ['email'] instead of $_POST ['memail'] [/code] silly misstake

Works just as i wanted i will now remember strpos

THANKS .

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.