Jump to content

Form problems


Recommended Posts

I'm fiddling with this script for an application. Can't quite get it to act right. When I try to submit a name containing a ', it removes the ' and whatever occurs after it, and replaces with a single \Here's the php and the html for the specific part of the form giving me problems. Thanks in advance.

<?php                    $CharacterName = $_REQUEST['CharacterName'];                    $Nation = $_REQUEST['Nation'];                    $RaceIhthian = $_REQUEST['RaceIhthian'];                    $RaceIkarrii = $_REQUEST['RaceIkarrii'];                    $Race = $RaceIhthian.$RaceKiil;                    $CharacterAge = $_REQUEST['CharacterAge'];                    $Gender = $_REQUEST['Gender'];                    $Guild = $_REQUEST['Guild'];                    $History = $_REQUEST['History'];                    $WritingSample = $_REQUEST['WritingSample'];                    $Email = $_REQUEST['Email'];                    $Alias = $_REQUEST['Alias'];                    $YourAge = $_REQUEST['YourAge'];                    $YourGender = $_REQUEST['YourGender'];                    $Icq = $_REQUEST['Icq'];                    $Aim = $_REQUEST['Aim'];                    $Msn = $_REQUEST['Msn'];                    $Subject = "~Character Information~\r\n\r\n\r\n~Name~\r\n$CharacterName\r\n\r\n~Nationality~\r\n$Nation\r\n\r\n~Race~\r\n$Race\r\n\r\n~Age~\r\n$CharacterAge\r\n\r\n~Gender~\r\n$Gender\r\n\r\n~Guild~\r\n$Guild\r\n\r\n~Brief History~\r\n$History\r\n\r\n~Writing Sample~\r\n$WritingSample\r\n\r\n\r\n~Personal Information~\r\n\r\n\r\n~Name/Alias~\r\n$Alias\r\n\r\n~Age~\r\n$YourAge\r\n\r\n~Age~\r\n$YourAge\r\n\r\n~ICQ~\r\n$Icq\r\n\r\n~AIM~\r\n$Aim\r\n\r\n~MSN~\r\n$Msn";                    $errors = Array();                    if( ereg("^([0-9][!#$%*/?|^{}~&+-=_])*$",$CharacterName))                        $errors[] = "<h3>Your Character's name is invalid. Please try again.</h3>";                    if( !isset ($Nation))                        $errors[] = "<h3>Please choose a species for your character.</h3>";                    if( (($Nation == "Ihthian") xor ($Nation == "Ikarrii")) and ($RaceIhthian == "void") and ($RaceIkarrii == "void"))                        $errors[] = "<h3>The Species you have chosen Requires you to choose a sub-race.</h3>";                    if( (($RaceIhthian == "void") and ($RaceIkarrii != "void")) and ($Nation == "Ihthian"))                        $errors[] = "<h3>The sub-race you have chosen is invalid.</h3>";                    if( (($RaceIkarrii == "void") and ($RaceIhthian != "void")) and ($Nation == "Ikarrii"))                        $errors[] = "<h3>The sub-race you have chosen is invalid.</h3>";                    if( (($RaceIhthian != "void") or ($RaceIkarrii != "void")) and ($Nation != "Ihthian") and ($Nation != "Ikarrii"))                        $errors[] = "<h3>You cannot choose a sub race for that species.</h3>";                    if( (($Nation == "Ihthian") xor ($Nation == "Ikarrii")) and ($RaceIhthian != "void") and ($RaceIkarrii != "void"))                        $errors[] = "<h3>You have chosen too many sub-races.</h3>";                    if( !isset ($Gender))                        $errors[] = "<h3>Please select a gender for your character.</h3>";                    if( !eregi ("^[a-z0-9]+([!#$%*/?|^{}`~&'+-=_][a-z0-9])*@[a-z0-9]+([!#$%*/?|^{}`~&'+-=_][a-z0-9])*.[a-z]{2,3}$",$Email))                        $errors[] = "<h3>Please Enter a Valid Email Address</h3>";                    if(empty($errors) and isset($Email))                    {                        mail( "author@tsrealms.com",$Email,$Subject, "From: $Email" );                        mail( $Email,"A copy of your Application", $Subject, "From: The Shattered Realms" );                        echo "<h1>Thank you for your application! One of the admins should be getting back to you via email within 24 hours. If you're accepted, you'll be given the link to register a user name on the message board. A copy of your application has been emailed to you.</h1>";                    }                    else                    {                        foreach($errors AS $e)                              echo $e; // displays error msg                              include "appform.txt";                    }                ?>

<input type="text" name="CharacterName" size="20" value='<?php echo $CharacterName?>' />

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...