Link to home
Start Free TrialLog in
Avatar of tankergoblin
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="processRegistration.php">

at the same time i have validation as below
<?php      
            if( isset($_POST['send'])):
            ?>            
            
                        <div id="error">
                              <ul>
                                    <?php                                        
                                       if(!validateName($_POST['name'])):
                                    ?>
                                          <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>Congratulations!</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'.
Avatar of Loganathan Natarajan
Loganathan Natarajan
Flag of India image

Try with jquery validations, http://jquery.bassistance.de/validate/demo/
Avatar of tankergoblin
tankergoblin

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.
i know i mean border for the form not for the message
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial