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
https://forums.phpfreaks.com/topic/38021-solved-need-some-input/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.