Positioning errors :S
-
hello, i hope one of you lot can help me ... i am creating a form for registration to my site... it all works i just need to know how i would position an error from process.php eg//
echo('The username/email you have entered already exists, please try again');
include("register.php");in the registration document register.php, is there a way to put this certain "echo" into a div ?
div id = " error " / d i v
Thanks
-
hello, i hope one of you lot can help me ... i am creating a form for registration to my site... it all works i just need to know how i would position an error from process.php eg//
echo('The username/email you have entered already exists, please try again');
include("register.php");in the registration document register.php, is there a way to put this certain "echo" into a div ?
div id = " error " / d i v
Thanks
-
hello, i hope one of you lot can help me ... i am creating a form for registration to my site... it all works i just need to know how i would position an error from process.php eg//
echo('The username/email you have entered already exists, please try again');
include("register.php");in the registration document register.php, is there a way to put this certain "echo" into a div ?
div id = " error " / d i v
Thanks
I try to write in a way people understand simply, so if its a little "fluffy" then I apologize in advance.
I'd probably make a function that scans the inputs from the form, and checks them. Then the second part of the function would be to spit out the errors that were made. Kind of like (e.g.) if the username space is blank, then report an error. The div id 'errors' would be where your errors would be spat out. (Registration page)
<div id="regform">
<div id="errors">
<?php
validateInputs();
?>
</div>
<?php
include("register.php");
?>
</div>(Function, theory I guess)
function validateInputs(){
$username = $__POST["username"]; #name referring to the entities of <input name="nameHere" >
...php script that checks the length of the input, and for false positives, like a bunch of spaces,
or perhaps a name consisting of one character, or patterns like that. Also use it to check if the username
is being used or not...Then echo out what errors were triggered, on that page, and if you have no errors,
you could give a check image or something. I'm not too sure.
}hope this helps. I heard you can also do form validation with jQuery http://www.webreference.com/programming/javascript/jquery/form_validation/[^]
-
I try to write in a way people understand simply, so if its a little "fluffy" then I apologize in advance.
I'd probably make a function that scans the inputs from the form, and checks them. Then the second part of the function would be to spit out the errors that were made. Kind of like (e.g.) if the username space is blank, then report an error. The div id 'errors' would be where your errors would be spat out. (Registration page)
<div id="regform">
<div id="errors">
<?php
validateInputs();
?>
</div>
<?php
include("register.php");
?>
</div>(Function, theory I guess)
function validateInputs(){
$username = $__POST["username"]; #name referring to the entities of <input name="nameHere" >
...php script that checks the length of the input, and for false positives, like a bunch of spaces,
or perhaps a name consisting of one character, or patterns like that. Also use it to check if the username
is being used or not...Then echo out what errors were triggered, on that page, and if you have no errors,
you could give a check image or something. I'm not too sure.
}hope this helps. I heard you can also do form validation with jQuery http://www.webreference.com/programming/javascript/jquery/form_validation/[^]