Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
check form fields

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> PHP
View previous topic :: View next topic  
Author Message
rberbe2002
Fairly Frequent Poster
Fairly Frequent Poster


Joined: 06 Jul 2006
Posts: 10

PostPosted: Thu Jul 06, 2006 2:36 pm    Post subject: check form fields Reply with quote

i have used ajax to validate fields on my form which works perfectly...

i have a emailfield which i want to make sure the person has inputted a proper email addres....

elseif($field == "emailfield")
{

$query = "SELECT * FROM members WHERE members_email = '".$emailfield."'";
$result = mysql_query($query) or die ("<h2>Could not select email address</h2>".mysql_error());
$num = mysql_num_rows($result);

if($num !=0)
{
$output = "emailfield| <img src='http://www.allinthissite.co.uk/include/images/cross.gif' alt='Email is not avaliable.' width='14' height='14'>";
}
else
{
if($emailfield == "")
{
$output = "emailfield| <img src='http://www.allinthissite.co.uk/include/images/cross.gif' alt='Please enter email.' width='14' height='14'>";
}
else
{
$output = "emailfield| <img src='http://www.allinthissite.co.uk/include/images/tick.gif' alt='Email is avaliable.' width='14' height='14'>";
}
}

}

thats my code...
Back to top
View user's profile Send private message
admin
Assistant Forum Supervisor
Assistant Forum Supervisor


Joined: 29 Oct 2003
Posts: 154

PostPosted: Thu Jul 06, 2006 2:59 pm    Post subject: hi Reply with quote

i don't understand, do you need help ?

where's the rest of your code, there's no ajax here Smile
Back to top
View user's profile Send private message
rberbe2002
Fairly Frequent Poster
Fairly Frequent Poster


Joined: 06 Jul 2006
Posts: 10

PostPosted: Thu Jul 06, 2006 3:08 pm    Post subject: yes i need help Reply with quote

i dont need help with the ajax bit.... i need help within the code below...

wat the code does is put a X if the email address already exsists in the table, if it doesnt, it then checks if someone has entered it, if they havnt it puts a X and if it is entered i want to make sure that the, email address is a proper format i.e. email@msn.com and if not, say they just enter email@msn
Back to top
View user's profile Send private message
rberbe2002
Fairly Frequent Poster
Fairly Frequent Poster


Joined: 06 Jul 2006
Posts: 10

PostPosted: Thu Jul 06, 2006 3:09 pm    Post subject: view it at Reply with quote

view it at http://www.allinthissite.co.uk/index/index.php?page=account&action=home
Back to top
View user's profile Send private message
admin
Assistant Forum Supervisor
Assistant Forum Supervisor


Joined: 29 Oct 2003
Posts: 154

PostPosted: Thu Jul 06, 2006 3:29 pm    Post subject: eregi function Reply with quote

Code:
$string = $_POST['ownerEmail'];

if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $string) ) {
$problem = TRUE;
$error = 'Mail address has incorrect format'; }
Back to top
View user's profile Send private message
deejay
Forum Assistant
Forum Assistant


Joined: 17 May 2006
Posts: 78
Location: Netherlands

PostPosted: Thu Jul 06, 2006 3:38 pm    Post subject: Server side solution Reply with quote

By the way, that's the server side solution,

this is also possible in javascript.

regards, dj
_________________
please correct me if i am wrong
seo-expertglobalwarming
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
rberbe2002
Fairly Frequent Poster
Fairly Frequent Poster


Joined: 06 Jul 2006
Posts: 10

PostPosted: Thu Jul 06, 2006 3:39 pm    Post subject: sorted Reply with quote

yeah its fine that code.....

cheers for the help....
Back to top
View user's profile Send private message
admin
Assistant Forum Supervisor
Assistant Forum Supervisor


Joined: 29 Oct 2003
Posts: 154

PostPosted: Thu Jul 06, 2006 3:42 pm    Post subject: no problemo Reply with quote

No problemo
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> PHP All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert