avo Posted April 26, 2006 Share Posted April 26, 2006 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 errorsif 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 Link to comment Share on other sites More sharing options...
SharkBait Posted April 26, 2006 Share Posted April 26, 2006 [!--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 errorsif 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. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 26, 2006 Share Posted April 26, 2006 [code]if (strpos($_POST['email'], '@') !== false) { # has '@' symbol}else { # invalid email address}[/code] Quote Link to comment Share on other sites More sharing options...
avo Posted April 26, 2006 Author Share Posted April 26, 2006 Thankyou Much appriciated. Quote Link to comment Share on other sites More sharing options...
avo Posted April 26, 2006 Author Share Posted April 26, 2006 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 pressentif (strpos($_POST['email'], '@') !== false) {$frm_check_email = "good";}else {$frm_check_email = "bad"; $frm_check = "bad";}[/code]hope you can help again thanks. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 27, 2006 Share Posted April 27, 2006 try echoing the $_POST['email'] as a check. I get 'good' if there's an '@'. Quote Link to comment Share on other sites More sharing options...
avo Posted April 27, 2006 Author Share Posted April 27, 2006 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 strposTHANKS . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.