how can i validate a form designed in php using javascript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

how can i validate a form designed in php using javascript

Post by softsolvers »

hello friends
i like to validate a form designed in php and html with java script.
i had used the image to link on the other page.
snap shot of the code i am using::
echo"<form method=POST action=frmdisplay.php>";
echo"<input type=text name=txtname size=30>";
echo"<a href=frmdisplay.php><image src='test.jpg'></a>";
echo"</form>";


now i like to validate the text box that if it is not filled the n it should prompt what should i do.
plz send me the code to do this.
i also like to ask that can i use the value passed in the javascript func. in the php in the same page
User avatar
Pointybeard
Forum Commoner
Posts: 71
Joined: Wed Sep 03, 2003 7:23 pm
Location: Brisbane, AUS
Contact:

Post by Pointybeard »

well php just renders a page for display, the javascript would still execute normally in the final page. All you gotta do is place the javascript in as per normal. Theres heaps of tuts around for that sort of thing. Try googling. ;)

Form Validation Javascript

took me 2 sections.

-PB
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

Post by softsolvers »

i am a bit specific i am showing you the code from where i want to call the validation function
i am taking :
<input type=image src="path" onclick="call function">
now each time itr is returning to the true value while i am wanting that iff the field is not filled then it should stay on the same page
User avatar
Pointybeard
Forum Commoner
Posts: 71
Joined: Wed Sep 03, 2003 7:23 pm
Location: Brisbane, AUS
Contact:

Post by Pointybeard »

Did you even look at the google search results? i found at least 4 or so sites that answer your problem. ~:/
Post Reply