Jump to content
xisto Community

sagoral

Members
  • Content Count

    10
  • Joined

  • Last visited


Reputation Activity

  1. Upvote
    sagoral reacted to kritya in Php Form Validation Problem   
    This is a simple code but idk y it is not working i want to return a error if user has left any field empty. and a code to execute if everything is.
    If any one can give me ajax form validation script it would be better.

    <?phpinclude("global.php");$username = $_POST["username"];$dsiplayName = $_POST["displayName"];$pass = $_POST["password"];$pass2 = $_POST["password2"];$age = $_POST["age"];if($username==NULL || $diplayName==NULL || $pass==NULL || $pass2==NULL || $age==NULL){ echo "Fine";}else{ echo "Username not entered";}?>
  2. Upvote
    sagoral reacted to web_designer in Php Form Validation Problem   
    hi kirtya, i tested your code after the file you sent me and yes, it is not working properly. so i rewrite it and tested it and it works fine.


    <?phpif($_POST['username'] ==NULL || $_POST['displayName'] ==NULL || $_POST['password'] ==NULL || $_POST['password2'] ==NULL || $_POST['age'] ==NULL){ echo "please enter data ";}else echo "thank you.";?>
    please test this code and post the result in here. and i will try to find some good validation code in ajax or java script for you, good luck.
  3. Upvote
    sagoral reacted to truefusion in Php Form Validation Problem   
    Following from web_designer's code, rather than comparing against NULL, the function isset() should be used instead. PHP will not set a variable (or key in this case) unless data was sent using the POST method, therefore the if statament will evaluate to false if either of them is not set. If it still doesn't work, you should check the HTML form element to see if you set the method to "post". By default, the method for forms is "get", and so your code would never show the desired effect in such a case.
  4. Upvote
    sagoral reacted to kritya in Php Form Validation Problem   
    the function is post only i checked that i know that things isset function.
    But the isset again only worked with direct post variable only what the problem is there idk with variable declarations but it looks fine i still want some ajax script for form validation but could not find a good one for checking email is of correct format and it does not post's the data untill everything is fine and i dont want any pop box. with yes or no things

    If any one could find that for me or write that for one that would be great that is the only problem in my site.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.