troubleshooting Question

Why am I getting a parse error: syntax error, unexpected T_IF

Avatar of sallywizard
sallywizard asked on
PHPScripting Languages
8 Comments3 Solutions238 ViewsLast Modified:
this is the error: Parse error: syntax error, unexpected T_IF

the If is after a switch, which I believe I closed appropriately.
  this is the offending line:        (if $prevpage >0) (line 127 in code)
  this is the next offending line:           (if $nextpagenum!=11) {

If I remove the IFs (after the switch), then the page displays fine. no errors

I usually work in VBscript and this is my simple foray into PHP.

thx,
<?php
		$designpage = $_REQUEST['np']; 
		echo  $designpage;
//	'this page is included in the design.php page to deliver the particular designs to viewers
	
?>
<?php
	if ($_REQUEST['np'] =="" ) 
		$designpage = 1;
?>
<?php
	$prevpage = $designpage-1;
	//the following is just for testing to assure the calcs are correct
	echo $prevpage; echo "&nbsp;";
	//the following is just for testing to assure the calcs are correct
	$nextpagenum = $designpage+1;
	echo $nextpagenum; echo  "<br/>";		
	
//depending on the designpage, display images and pricing
	switch ($designpage) {
		CASE 1:
?>
			<p ><img src="images/styles/styles_backup/6dozcube150.jpg" alt="Six Dozen Roses" width="480" height="360"/></p>
			<p >6 dozen Roses arranged in an 8 inch cube vase<br/><span class="pricing">$150</span></p>
			<p ><img src="images/styles/styles_backup/Much.jpg" alt="Much Love" width="480" height="360"/></p>
			<p >Much Love<br/><span class="pricing">$150,compare at $200</span></p>
			<p ><img src="images/styles/styles_backup/lotsoflove2.jpg" alt="Lots of Love" width="480" height="324"/></p>
			<p >Lots of Love<br/><span class="pricing">$150,compare at $200</span></p>
<?php
			break;
		CASE 2:
?>
			<p><img src="images/styles/styles_backup/Cool.jpg" alt="Tropical Punch" width="480" height="610" /></p>
			<p >Tropical Punch <br/><span class="pricing">$75</span></p>
			<p><img src="images/styles/styles_backup/Warm_1.jpg" alt="Tahiti" width="480" height="640" /></p>
			<p >Tahiti<br/><span class="pricing">$75</span></p>
			<p><img src="images/styles/styles_backup/blush60.jpg" alt="Blush" width="480" height="464" /></p>
			<p >Blush<br/><span class="pricing">$60</span></p>
<?php
			break;
		CASE 3:
?>
				<p><img src="images/styles/styles_backup/2doz60.jpg" alt="Two Dozen Red Roses" width="480" height="529" /></p>
				<p >Two Dozen Red Roses<span class="pricingred">$100 during Valentines week </span></p>
				<p><img src="images/styles/styles_backup/pink60.jpg" alt="In the Pink" width="480" height="401" /></p>
				<p >In the Pink<br/><span class="pricing">$60</span></p>
				<p><img src="images/styles/styles_backup/Monochromatic60.jpg" alt="Monochromatic" width="480" height="558" /></p>
				<p >Monochromatic in Cedar Box<br/><span class="pricing">$60</span></p>
<?php
			break;
		CASE 4:
?>
				<p><img src="images/styles/styles_backup/goldandgreen50.jpg" alt="Gold and Green" width="480" height="470" /></p>
				<p >Gold and Green<br/><span class="pricing">$60</span></p>
				<p><img src="images/styles/styles_backup/frosty50.jpg" alt="Frosty" width="480" height="360" /></p>
				<p >Frosty<br/><span class="pricing">$50</span></p>
				<p><img src="images/styles/styles_backup/SummerSun.jpg" alt="Summer Sun" width="480" height="556" /></p>
				<p >Summer Sun<br/><span class="pricing">$50</span></p>
<?php
			break;
		CASE 5:
?>
				<p><img src="images/styles/styles_backup/pastelSpring.JPG" alt="Pastel Spring" width="480" height="463" /></p>
				<p >Pastel Spring<br/><span class="pricing">$50</span></p>
				<p><img src="images/styles/styles_backup/seasonalSpring50.jpg" alt="Seasonal Springtime" width="480" height="640" /></p>
				<p >Seasonal Springtime<br/><span class="pricing">$50</span></p>
				<p><img src="images/styles/styles_backup/spicy50.jpg" alt="spicy" width="480" height="640" /></p>
				<p >Spicy<br/><span class="pricing">$50</span></p>
<?php
			break;
		CASE 6:
?>
				<p><img src="images/styles/styles_backup/Jeweltone.jpg" alt="Jeweltone" width="480" height="360" /></p>
				<p >Jeweltone<br/><span class="pricing">$50</span></p>
				<p><img src="images/styles/styles_backup/wintergreen50.jpg" alt="Tropical Winter Green" width="480" height="458" /></p>
				<p >Tropical Winter Green<br/><span class="pricing">$50</span></p>
				<p><img src="images/styles/styles_backup/DeluxeSpring.jpg" alt="Deluxe Spring" width="480" height="446" /></p>
				<p >Deluxe Spring<br/><span class="pricing">$50</span></p>
						  
<?php
			break;
		CASE 7:
?>
				<p><img src="images/styles/styles_backup/PeachesCream40.jpg" alt="Peaches and Cream" width="480" height="360" /></p>
				<p >Peaches and Cream<br/><span class="pricing">$40</span></p>
				<p><img src="images/styles/styles_backup/Periwinkle40.jpg" alt="Periwinkle" width="480" height="640" /></p>
				<p >Periwinkle<br/><span class="pricing">$40</span></p>
						  
<?php
			break;
		CASE 8:
?>
				<p><img src="images/styles/styles_backup/2091.jpg" alt="Dutch Winter" width="480" height="360" /></p>
				<p >Dutch Winter<br/><span class="pricing">$50</span></p>
				<p><img src="images/styles/styles_backup/Wild.jpg" alt="Wild Berry" width="480" height="459" /></p>
				<p >Wild Berry<br/><span class="pricing">$40</span></p>
				<p><img src="images/styles/styles_backup/Seasonal.jpg" alt="Dutch Springtime" width="480" height="457" /></p>
				<p >Dutch Springtime<br/><span class="pricing">$40</span></p>
<?php
			break;
		CASE 9:
?>
				<p><img src="images/styles/styles_backup/Warm_2.jpg" alt="Breakaway Set" width="480" height="360" /></p>
				<p >Breakaway Set<br/><span class="pricing">$40</span></p>
				<p><img src="images/styles/styles_backup/White.jpg" alt="Cool Breeze" width="480" height="360" /></p>
				<p >Cool Breeze<br/><span class="pricing">$40</span></p>
<?php
			break;
		CASE 10:
?>
				<p><img src="images/styles/styles_backup/Sympathy_3.jpg" alt="Sympathy number4" width="480" height="640" /></p>
				<p >Sympathy #4 <br/><span class="pricing">$200</span></p>
				<p><img src="images/styles/styles_backup/Sympathy_2.jpg" alt="Sympathy number3" width="480" height="529" /></p>
				<p >Sympathy #3<br/><span class="pricing">$150</span></p>
				<p><img src="images/styles/styles_backup/Sympathy_1.jpg" alt="Sympathy number2" width="480" height="640" /></p>
				<p >Sympathy #2 <br/><span class="pricing">$150</span></p>
				"<p><img src="images/styles/styles_backup/Sympathy.jpg" alt="Sympathy number1" width="480" height="647" /></p>
				"<p>Sympathy #1  <br/><span class="pricing">$100</span></p>
<?php
			break;
//end of the switch cases
}							
?>
<p >
<?php	
	//now check for and write link to previous page
	(if $prevpage >0) 
	?>
	 &raquo;<a href="designs.asp?np=<?php echo $prevpage; ?>">Previous Styles</a>
<?php 
?>
&nbsp;&nbsp;&nbsp;&nbsp;
<?php

	//now check for and write link to next page
	(if $nextpagenum!=11) {
?>
	<a href="designs.asp?np=<? echo $nextpagenum ?>" >More Styles &raquo;</a>
<?php
	 } 
?>

</p>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 3 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros