jme574 Posted July 3, 2005 Posted July 3, 2005 Ok, I used a form gen. to make a basic form for my sons game and when it was all done i get this error: Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/rune/public_html/forms/use/MembershipApplication/process.php on line 13Line 13 of the code is this: if($RunescapeName=="" || $CombatLevel=="" || $BestSkill=="" || $2ndBestSkill=="" || $3rdBestSkill=="" || $Email=="" ){ Anyone have any idea what this line should actually be?? Here is the whole code. <?phpinclude("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input."; pt_register('POST','RunescapeName'); pt_register('POST','CombatLevel'); pt_register('POST','BestSkill'); pt_register('POST','2ndBestSkill'); pt_register('POST','3rdBestSkill'); pt_register('POST','4thBestSkill'); pt_register('POST','5thBestSkill'); pt_register('POST','Email'); if($RunescapeName=="" || $CombatLevel=="" || $BestSkill=="" || $2ndBestSkill=="" || $3rdBestSkill=="" || $Email=="" ){ $errors=1; $error.="You did not enter one or more of the required fields. Please go back and try again."; } if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){ $error.="Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Runescape Name: ".$RunescapeName." Combat Level: ".$CombatLevel." Best Skill: ".$BestSkill." 2nd Best Skill: ".$2ndBestSkill." 3rd Best Skill: ".$3rdBestSkill." 4th Best Skill: ".$4thBestSkill." 5th Best Skill: ".$5thBestSkill." Email: ".$Email." "; $message = stripslashes($message); mail("branjahol@yahoo.com","Form Submitted at your website",$message,"From: phpFormGenerator"); $make=fopen("admin/data.dat","a"); $to_put=""; $to_put .= $RunescapeName."|".$CombatLevel."|".$BestSkill."|".$2ndBestSkill."|".$3rdBestSkill."|".$4thBestSkill."|".$5thBestSkill."|".$Email." "; fwrite($make,$to_put); ?> Thank you! Runescape Name: Combat Level: Best Skill: 2nd Best Skill: 3rd Best Skill: 4th Best Skill: 5th Best Skill: Email: Quote
TweezerMan Posted July 3, 2005 Posted July 3, 2005 (edited) The variable names $2ndBestSkill and $3rdBestSkill (as well as $4thBestSkill and $5thBestSkill) are invalid - variable names can't start with a number. PHP variable names can have numbers in them, but they must start with a letter or underscore character. I'd suggest renaming them as $Skill2ndBest, $Skill3rdBest, $Skill4thBest, $Skill5thBest. Edited July 3, 2005 by TCH-David Quote
jme574 Posted July 3, 2005 Author Posted July 3, 2005 Ok, now i have went through and changed out all of the examples that was causing the problem now i get this error when i run a practice form: The following errors occured while processing your form input.You did not enter one or more of the required fields. Please go back and try again. Even when I fill in all the fields. Any ideas? Here is the link:http://www.deathknightsrunescapeclan.com/f...tion/form1.html Here is the corrected code so far <?phpinclude("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.<ul>"; pt_register('POST','RunescapeName'); pt_register('POST','CombatLevel'); pt_register('POST','BestSkill'); pt_register('POST','Skill2ndBest'); pt_register('POST','Skill3rdBest'); pt_register('POST','Skill4thBest'); pt_register('POST','Skill5thBest'); pt_register('POST','Email'); if($RunescapeName=="" || $CombatLevel=="" || $BestSkill=="" || $Skill2ndBest=="" || $Skill3rdBest=="" || $Email=="" ){ $errors=1; $error.="<li>You did not enter one or more of the required fields. Please go back and try again."; } if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){ $error.="<li>Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Runescape Name: ".$RunescapeName." Combat Level: ".$CombatLevel." Best Skill: ".$BestSkill." 2nd Best Skill: ".$Skill2ndBest." 3rd Best Skill: ".$Skill3rdBest." 4th Best Skill: ".$Skill4thBest." 5th Best Skill: ".$Skill5thBest." Email: ".$Email." "; $message = stripslashes($message); mail("branjahol@yahoo.com","Form Submitted at your website",$message,"From: phpFormGenerator"); $make=fopen("admin/data.dat","a"); $to_put=""; $to_put .= $RunescapeName."|".$CombatLevel."|".$BestSkill."|".$Skill2ndBest."|".$Skill3rdBest."|".$Skill4thBest."|".$Skill5thBest."|".$Email." "; fwrite($make,$to_put); ?> <!-- This is the content of the Thank you page, be careful while changing it --> <h2>Thank you for filling out our Application form. An Admin will review your application and be in touch soon.</h2> <table width=50%> <tr><td>Runescape Name: </td><td> <?php echo $RunescapeName; ?> </td></tr> <tr><td>Combat Level: </td><td> <?php echo $CombatLevel; ?> </td></tr> <tr><td>Best Skill: </td><td> <?php echo $BestSkill; ?> </td></tr> <tr><td>2nd Best Skill: </td><td> <?php echo $Skill2ndBest; ?> </td></tr> <tr><td>3rd Best Skill: </td><td> <?php echo $Skill3rdBest; ?> </td></tr> <tr><td>4th Best Skill: </td><td> <?php echo $Skill4thBest; ?> </td></tr> <tr><td>5th Best Skill: </td><td> <?php echo $Skill5thBest; ?> </td></tr><tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr> </table> <!-- Do not change anything below this line --> <?php } ?> Quote
TweezerMan Posted July 3, 2005 Posted July 3, 2005 On the actual form, the input boxes have names that correspond to the variables in your PHP script, and you need to change the names on those input boxes to match the variable names you changed. Example: ><font face="Verdana"><input type=text name='2ndBestSkill'>*</td></tr><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> You need to change the name='2ndBestSkill' so that it matches the PHP variable name - 'Skill2ndBest'. Repeat for the other 3 form fields. Quote
jme574 Posted July 3, 2005 Author Posted July 3, 2005 ok, went through and changed everything to match and i am still getting this error: The following errors occured while processing your form input.You did not enter one or more of the required fields. Please go back and try again. Do you see what else might be wrong?<?phpinclude("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.<ul>"; pt_register('POST','RunescapeName'); pt_register('POST','CombatLevel'); pt_register('POST','BestSkill'); pt_register('POST','SecondBestSkill'); pt_register('POST','ThirdBestSkill'); pt_register('POST','FourthBestSkill'); pt_register('POST','FifthBestSkill'); pt_register('POST','Email'); if($RunescapeName=="" || $CombatLevel=="" || $BestSkill=="" || $SecondBestSkill=="" || $ThirdBestSkill=="" || $Email=="" ){ $errors=1; $error.="<li>You did not enter one or more of the required fields. Please go back and try again."; } if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){ $error.="<li>Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Runescape Name: ".$RunescapeName." Combat Level: ".$CombatLevel." Best Skill: ".$BestSkill." Second Best Skill: ".$SecondBestSkill." Third Best Skill: ".$ThirdBestSkill." Fourth Best Skill: ".$FourthBestSkill." Fifth Best Skill: ".$FifthBestSkill." Email: ".$Email." "; $message = stripslashes($message); mail("branjahol@yahoo.com","Form Submitted at your website",$message,"From: phpFormGenerator"); $make=fopen("admin/data.dat","a"); $to_put=""; $to_put .= $RunescapeName."|".$CombatLevel."|".$BestSkill."|".$SecondBestSkill."|".$ThirdBestSkill."|".$FourthBestSkill."|".$FifthBestSkill."|".$Email." "; fwrite($make,$to_put); ?> <!-- This is the content of the Thank you page, be careful while changing it --> <h2>Thank you for filling out our Application form. An Admin will review your application and be in touch soon.</h2> <table width=50%> <tr><td>Runescape Name: </td><td> <?php echo $RunescapeName; ?> </td></tr> <tr><td>Combat Level: </td><td> <?php echo $CombatLevel; ?> </td></tr> <tr><td>Best Skill: </td><td> <?php echo $BestSkill; ?> </td></tr> <tr><td>Second Best Skill: </td><td> <?php echo $SecondBestSkill; ?> </td></tr> <tr><td>Third Best Skill: </td><td> <?php echo $ThirdBestSkill; ?> </td></tr> <tr><td>Fourth Best Skill: </td><td> <?php echo $FourthBestSkill; ?> </td></tr> <tr><td>Fifth Best Skill: </td><td> <?php echo $FifthBestSkill; ?> </td></tr><tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr> </table> <!-- Do not change anything below this line --> <?php } ?> If i change this: $SecondBestSkill=="" || $ThirdBestSkill=="" || $Email=="" ){$errors=1; $error.="<li>You did not enter one or more of the required fields. Please go back and try again."; to: $errors=0; The form will submit successfully but only the Best Skill appears in the form but not the other 4 skills. Quote
TweezerMan Posted July 3, 2005 Posted July 3, 2005 You didn't edit the actual form that I was referring to in my last post. That form is in the file /public_html/forms/use/MembershipApplication/form1.html, and within that file are the input box fields you need to edit to match the PHP script's variable names. Quote
jme574 Posted July 4, 2005 Author Posted July 4, 2005 That worked! thank you, it took awhile but with your help we got it! Thats why we like TCH and the family here so much. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.