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.
Link to comment
Share on other sites

[!--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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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