Jump to content

[SOLVED] Need some input.


jscix

Recommended Posts

Okay, there is no problems in the code, it all works, however.. I know there has to be a better way.

 

What I want to know is:

--How could I check the values of two text feilds, and basically print an error message if they dont meet a certain criteria.

--IF they do meet the criteria, then perform the next step in the code.

 

You can see how I did this below, but I want to refine it to check for a bit more than just a (NULL) Value.

The way it is now, is sloppy/ineffeciant.. anyone have some pointers?

<?php
require "forms.php";

$usrfeild = $_GET["usrfeild"];
$pwfeild = $_GET["pwfeild"];



if ($usrfeild == (NULL)) {
$a = "0";
print "Please enter a username!";
die();
}
else {
$a = "1";

}


if ($pwfeild == (NULL)) {
$b = "0";
print "Please enter a password!";
die();
}
else {
$b = "1";

}

$bothh = ($a + $b);

if ($bothh="2"){
require "list.php";
}
else
{
print "Enter User/PW";
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.