User-defined tag question
Posted: Mon Jun 12, 2006 8:58 pm
Hey guys, I'm running cmsms 0.13, php 4.3.11, mysql 4.0.27-standard and Apache 1.3.34 (Unix), and I'm trying to implement a quickie one-off registration system for a special event.
I already have a form defined in a content page that accepts the info I need, I'm working on the post target page, which is the basic "read things out of _POST and execute an INSERT statement against a table" type of thing. I am trying to do this as a content page containing a single UDT, which in turn contains my post-processing code, which, for the sake of completeness, looks like this:
When I try to save this code as a UDT, I get an "Invalid code entered." error message. The docs I've looked at are sketchy on this, if they mention it at all. Is this error because of the tag I'm echoing out, or is this a parse error in the script itself?
I already have a form defined in a content page that accepts the info I need, I'm working on the post target page, which is the basic "read things out of _POST and execute an INSERT statement against a table" type of thing. I am trying to do this as a content page containing a single UDT, which in turn contains my post-processing code, which, for the sake of completeness, looks like this:
Code: Select all
if( count($_POST) != 0 && isset($_POST["submit"]))
{
$real_name = mysql_real_escape_string($_POST["real_name"]);
$gamer_name = mysql_real_escape_string($_POST["gamer_name"]);
$email = mysql_real_escape_string($_POST["email"]);
$age = mysql_real_escape_string($_POST["age"]);
$birth_month = mysql_real_escape_string($_POST["birth_month"]);
$birth_day = mysql_real_escape_string($_POST["birth_day"]);
$preferred_tryout = mysql_real_escape_string($_POST["preferred_tryout"]);
$query = "INSERT INTO cs_tryouts VALUES ('$real_name', '$gamer_name', '$email', $age, $birth_month, $birth_day, '$preferred_tryout')";
$linkid = @mysql_connect("localhost", "[CENSORED]", "[CENSORED]");
or die("Could not open MySQL on localhost");
@mysql_select_db("w00tz_tryouts") or die("Count not open database w00tz_tryouts");
$result = mysql_query($query);
if($result)
{
echo( "Thanks for registering, $gamer_name. We will contact you via e-mail shortly with a definite tryout date. If you have any questions regarding your registration, please feel free to contact w00tz! directly.");
}
else
{
echo("There was a problem processing your registration. Please try again later.");
}
@mysql_close();
exit;
}
else
{
echo("You have reached this page in error. [<a href='index.php'>Return to w00tz!</a>]");
}