For some reason the add() function won't add the string to the $error variable. I've been poking around with this for a while now, and I just can't get it. It's probably just some stupid mistake I'm overlooking.Code:<?php session_start(); $answer = $_SESSION["answer"]; $user = $_POST["user"]; $pass = $_POST["pass"]; $cpass = $_POST["cpass"]; $email = $_POST["email"]; $cemail = $_POST["cemail"]; $valid = $_POST["valid"]; $error = ""; $count = 0; function add($txt) { global $count, $error; $count++; $error .= "\n<br>".$count.". ".$txt; }; if ($cpass != $pass) { add("Your second password did not match the original."); }; if ($cemail != $email) { add("Your second e-mail address did not match the original."); }; if ($valid != $answer) { add("Your Roman Numeral answer did not match! Please click the link regarding Roman Numerals on the previous page."); }; if (!eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email)) { add("You did not enter a valid e-mail."); }; echo $error; ?>



Reply With Quote

Bookmarks