Jump to content

[SOLVED] Hmm?


sstangle73

Recommended Posts

Parse error: syntax error, unexpected T_IF in /homepages/27/d193007783/htdocs/NYEFC/process.php on line 118

 

<?php						if($_POST['team_tryout'] == "null"){
						$team = $_POST['team_tryout'];
						$text = "
						<tr>
                        	<td width=\"35%\">Team To Tryout For:</td>
                          <td width=\"65%\">
					  <select name=\"team_tryout\" class=\"input_style_bad\">
                            <option value=\"BU23\" " . if($team == "BU23"){echo "/"selected/"";} . ">Boys U23</option>
                            <option value=\"BU19\" " . if($team == "BU19"){echo "/"selected/"";} . ">Boys U19</option>
                            <option value=\"BU18\" " . if($team == "BU18"){echo "/"selected/"";} . ">Boys U18</option>
                            <option value=\"BU17\" " . if($team == "BU17"){echo "/"selected/"";} . ">Boys U17</option>
                            <option value=\"BU16\" " . if($team == "BU16"){echo "/"selected/"";} . ">Boys U16</option>
                            <option value=\"BU15\" " . if($team == "BU15"){echo "/"selected/"";} . ">Boys U15</option>
                            <option value=\"BU14\" " . if($team == "BU14"){echo "/"selected/"";} . ">Boys U14</option>
                            <option value=\"BU13\" " . if($team == "BU13"){echo "/"selected/"";} . ">Boys U13</option>
                            <option value=\"BU12\" " . if($team == "BU12"){echo "/"selected/"";} . ">Boys U12</option>
                            <option value=\"BU11\" " . if($team == "BU11"){echo "/"selected/"";} . ">Boys U11</option>
                            <option value=\"BU10\" " . if($team == "BU10"){echo "/"selected/"";} . ">Boys U10</option>
                            <option value=\"BU8\" " . if($team == "BU8"){echo "/"selected/"";} . ">Boys U8</option>
                            <option value=\"null\" " . if($team == "null"){echo "/"selected/"";} . ">---------</option>
                            <option value=\"GU23\" " . if($team == "GU23"){echo "/"selected/"";} . ">Girls U23</option>
                            <option value=\"GU19\" " . if($team == "GU19"){echo "/"selected/"";} . ">Girls U19</option>
                            <option value=\"GU18\" " . if($team == "GU18"){echo "/"selected/"";} . ">Girls U18</option>
                            <option value=\"GU17\" " . if($team == "GU17"){echo "/"selected/"";} . ">Girls U17</option>
                            <option value=\"GU16\" " . if($team == "GU16"){echo "/"selected/"";} . ">Girls U16</option>
                            <option value=\"GU15\" " . if($team == "GU15"){echo "/"selected/"";} . ">Girls U15</option>
                            <option value=\"GU14\" " . if($team == "GU14"){echo "/"selected/"";} . ">Girls U14</option>
                            <option value=\"GU13\" " . if($team == "GU13"){echo "/"selected/"";} . ">Girls U13</option>
                            <option value=\"GU12\" " . if($team == "GU12"){echo "/"selected/"";} . ">Girls U12</option>
                            <option value=\"GU11\" " . if($team == "GU11"){echo "/"selected/"";} . ">Girls U11</option>
                            <option value=\"GU10\" " . if($team == "GU10"){echo "/"selected/"";} . ">Girls U10</option>
                            <option value=\"GU8\" " . if($team == "GU8"){echo "/"selected/"";} . ">Girls U8</option>
                          </select></td>
                      </tr>
							<input type=\"hidden\" name=\"goodsubmit\" value=\"bad\">
						";		
						echo $text;
						$submit1 = "bad";
					}?>

 

cant quit seem to get it to work thanks in advance for the help!

Link to comment
Share on other sites

And this is the entire contents of the file "process.php"? It doesn't even go to line 118?

 

Regardless of the file though...im not sure I have ever seen concatenation >> to an if statement >> to an echo statement ( don't think that is valid syntax...)

Link to comment
Share on other sites

no i figured the rest of the file would be a little excessive. well thats what im tring to figure out how to show the field they picked in the echo

 

118 is  <option value=\"BU23\" " . if($team == "BU23"){echo "/"selected/"";} . ">Boys U23</option>

Link to comment
Share on other sites

Are we to assume that the user has the opportunity to choose a team to try out for earlier in the code?  If so, why not include a statement in the code that looks something like this:

 

if($_POST['team_tryout'] == "null"){
    echo "Please select a team to try out for."
   }
   else{
     //continue code here
}
         

 

If you would like to achieve the same effect without leaving your initial form that we are getting these posts from, include some javascript in the header that tests to see if there is a selection.

<script language="Javascript">
function validate(form) {
var elem = form.elements;

if (elem.team_tryout.value == null) {
	alert ('Please check your team tryout selection.');
	return false;
	}
else {
return true;
}

}
</script>

 

Then put in your form onsubmit="return validate(this);"

 

I'm making a few assumptions here, but I hope this helps.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.