tankergoblin
asked on
how to show validation or message in one page
Hi,
i want to create a form...
my form point to processregistration.php as below
<form method="post" id="customForm" action="processRegistratio n.php">
at the same time i have validation as below
<?php
if( isset($_POST['send'])):
?>
<div id="error">
<ul>
<?php
if(!validateName($_POST['n ame'])):
?>
<li><strong>Invalid Name:</strong> We want names with more than 3 letters!</li>
<?php
endif
?>
</ul>
</div>
<?php
elseif(isset($_POST['send' ])):
?>
<div id="error" class="valid">
<ul>
<li><strong>Congratulation s!</strong > All fields are OK ;)</li>
</ul>
</div>
<?php
endif
?>
now my problem is if i use action in my form it will direct me to new page...
how to make everything shows in one page. Thank you'.
i want to create a form...
my form point to processregistration.php as below
<form method="post" id="customForm" action="processRegistratio
at the same time i have validation as below
<?php
if( isset($_POST['send'])):
?>
<div id="error">
<ul>
<?php
if(!validateName($_POST['n
?>
<li><strong>Invalid Name:</strong> We want names with more than 3 letters!</li>
<?php
endif
?>
</ul>
</div>
<?php
elseif(isset($_POST['send'
?>
<div id="error" class="valid">
<ul>
<li><strong>Congratulation
</ul>
</div>
<?php
endif
?>
now my problem is if i use action in my form it will direct me to new page...
how to make everything shows in one page. Thank you'.
Try with jquery validations, http://jquery.bassistance.de/validate/demo/
ASKER
i found the way dy.. thank you for your info... can i know how to do a rectangular border line with css on my form ?? thank you.
A border is done in CSS with "border: 1px solid #000000;" for a 1px wide solid black border. Put it in a div that encloses the area you want a box around.
In your code above, you are using id="error" in two different places. 'id' is supposed to be unique, only used once on a page, while 'class' is for applying to more than one element. If you use javascript or jquery on that page, it will only find the first instance of the 'id' which may not be what you want. Make 'id's unique on each page.
In your code above, you are using id="error" in two different places. 'id' is supposed to be unique, only used once on a page, while 'class' is for applying to more than one element. If you use javascript or jquery on that page, it will only find the first instance of the 'id' which may not be what you want. Make 'id's unique on each page.
ASKER
i know i mean border for the form not for the message
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.