|
|
 |
RE: FN-FORUM: PHP - WHAT AM I DOING WRONG
date posted 14th June 2003 18:17
Pam wrote:
> sorry - it still doesn't work :-
>
> function valid_form($Franchise, $Maximum) {
> $Error_msgs = 0;
> if ($Franchise === "Select") {
> $GLOBALS['Franchise_Error_msg'] = "Please select a Franchise";
> $Error_msgs = $Error_msgs + 1;
Ick. Why not use '$Error_msgs++'?
> }
> $Maximum = trim($Maximum);
> if (($Maximim !== "") & !(is_numeric($Maximum))) {
If you want to check if it's empty, use: is_empty($Maximum).
> $GLOBALS['Maximum_Error_msg'] = "Please complete a valid maximum
> or leave blank";
> $Error_msgs = Error_msgs + 1;
> }
> echo $GLOBALS['Franchise_Error_msg'];
> echo $GLOBALS['Maximum_Error_msg'];
> if ($Error_msgs > 0)
> RETURN False;
You mean 'return'.
> else
> RETURN True;
> }
>
> session_start();
> if (!(isset($HTTP_SESSION_VARS["User_Id"])) &
> !(isset($HTTP_SESSION_VARS["User_Password"])))
Don't use the old-style globals ($HTTP_SESSION_VARS, $HTTP_POST_VARS,
$_HTTP_SERVER_VARS), use the new ones ($_POST, $_SESSION, $_SERVER) instead.
> header('Location: http://' . $_SERVER['HTTP_HOST'] .
> dirname($_SERVER['PHP_SELF']) . 'password.htm');
> $Franchise_error_msg = "";
> $Maximum_error_msg = "";
> if (($_POST['submit'] === "SEND") & valid_form($_POST['Franchise'],
> $_POST['Maximum'])){ $page = "Part_Number=" .
> trim($_POST['Part_Number']) . "&Description=" .
> trim($_POST['Description']) . "&Franchise=" .
> trim($_POST['Franchise']) . "&Maximum=" . trim($_POST['Maximum']);
Don't do this ampersand-thing when you're composing URLs. Remember that an
ampersand signifies the beginning of an HTML character entity (as in )
and since '&Description' is not a valid entity, this won't be valid HTML.
Change that part to "&Description", similarly the rest.
> header('Location: http://' . $_SERVER['HTTP_HOST'] .
> dirname($_SERVER['PHP_SELF']) . 'part_selection_main.php?' .
> "$page"); }
- Nick Grimshaw
{ if you're not part of the solution, you're part of the precipitate. }
|
 |
|