Here's my problem. I have a program that integrates HTML with PHP script by ending the PHP, and going with straight HTML code, and then going back to PHP. This should be all well and done, except for the part where after I start the PHP script, it doesn't display any of the content that should be displayed.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en-us">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="Generator" content="Serif WebPlus X4 (12.0.4.031)">
	<title>A Touch of Moore</title>
	<meta name="keywords" content="Massage, Massage Therapy, Swedish massage, Waxing, Hair removal, beauty, salon, spa, day spa, hot stone, pedi, pedicure, manicure, permanent makeup, chemical peel, peels, facial, body treatment, Norwich, NY, New York, Chenango County, Massage, Massage Therapy, Swedish massage, Waxing, Hair removal, beauty, salon, spa, day spa, hot stone, pedi, pedicure, manicure, permanent makeup, chemical peel, peels, facial, body treatment, Norwich, NY, New York, Chenango County">
	<meta name="description" content="Norwich, NY Massage Therapy, Swedish Massage, ">
	<meta name="author" content="Dinnett Moore">
	<meta http-equiv="Content-Language" content="en-us">
	<link rel="icon" href="favicon.ico" type="image/x-icon">
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
	<script type="text/javascript" src="_wp_scripts/jsNavBarFuncs.js"></script>
	<script type="text/javascript" src="_wp_scripts/global_navtree.js"></script>
	<script type="text/javascript" src="_wp_scripts/wp_navbar_flash.js"></script>
	<style type="text/css">
	<!--
		body {margin: 0px; padding: 0px;}
		a:link {color: #000080;}
		a:visited {color: #000080;}
		a:hover {color: #000080;}
		a:active {color: #000080;}
		.Normal-P
		{
			margin:0.0px 0.0px 10.0px 0.0px; text-align:left; font-weight:400; 
        }
		.Normal-P0
		{
			margin:7.0px 0.0px 7.0px 0.0px; text-align:left; font-weight:400; 
        }
		.Normal-P1
        {
			margin:7.0px 0.0px 7.0px 0.0px; text-align:left; font-weight:400; 
			text-indent:32.0px; 
        }
		.Normal-P2
        {
			margin:7.0px 0.0px 7.0px 0.0px; text-align:left; font-weight:400; 
			text-indent:33.0px; 
        }
		.Normal-P3
        {
			margin:0.0px 0.0px 0.0px 0.0px; text-align:left; font-weight:400; 
			text-indent:33.0px; 
        }
		.Normal-P4
        {
			margin:0.0px 0.0px 0.0px 0.0px; text-align:left; font-weight:400; 
        }
		.Normal-P5
        {
			margin:0.0px 0.0px 0.0px 53.0px; text-align:left; font-weight:400; 
			text-indent:-20.0px; 
        }
		.Normal-C
        {
			font-family:"Arial", sans-serif; font-weight:700; font-size:20.0px; 
			line-height:1.25em; 
        }
		.Normal-C0
        {
			font-family:"Arial", sans-serif; font-size:16.0px; line-height:1.19em; 
        }
		.Normal-C1
        {
			font-family:"Arial", sans-serif; font-size:18.0px; line-height:1.22em; 
        }
		.Normal-C2
        {
			font-family:"Arial", sans-serif; font-size:13.0px; line-height:1.23em; 
        }
		.Normal-C3
        {
			font-family:"Arial", sans-serif; font-size:15.0px; line-height:1.13em; 
        }
		.Normal-C4
        {
			font-family:"Wingdings", serif; font-size:15.0px; line-height:1.07em; 
        }
		.Normal-C5
        {
			font-family:"Arial", sans-serif; font-size:15.0px; line-height:1.13em; 
			color:#0000ff; text-decoration: underline; 
        }
		.Body-C
        {
			font-family:"Times New Roman", serif; font-size:13.0px; 
			line-height:1.23em; color:#777777; 
        }
		-->
	</style>
	<script type="text/javascript" src="_wp_scripts/jsFlashVer.js"></script>
	<script type="text/javascript" src="_wp_scripts/jspngfix.js"></script>
	<script type="text/javascript"><!--
	var blankSrc = "_wp_scripts/blank.gif";
	--></script>
	</head>
	<body text="#000000" style="background-color:#f3f3e4; text-align:center; height:1000px;">
		<div style="background-color:transparent;text-align:left;margin-left:auto;margin-right:auto;position:relative;width:950px;height:1000px;">
		<div style="position:absolute; left:500px; top:68px; width:438px; height:283px;">
			<img src="_wp_generated/wpb07d38a0.png" width="438" height="283" border="0" id="pic_18" name="pic_18" title="" alt="" onload="OnLoadPngFix()"></div>
			<div id="nav_322" style="position:absolute; left:10px; top:350px; width:208px; height:356px; z-index:200;">
				<script type="text/javascript" id="nav_322_script"><!--
				try 
				{
					var navtree_nav_322 = WpNavBar.getNavTreeTopLevel( global_navtree, {m_sThisPageUrl:'index.html',
					m_sNavBarTarget:'_self',
					m_bIncludeAnchors:false,
					m_bFlash:true,
					m_bIncludeChildren:true,
					m_bHideCurrent:false} );
					if( !navtree_nav_322 ) 
						throw WpNavBar.getErrorObj( 'Link tree could not be read' );
					var nav_322 = new wp_navbar_flash("nav_322", navtree_nav_322, {'ExportNoScript':false,m_iWidth:208,
					m_iHeight:356,'pageCol':'#f3f3e4'}, {'sFlashFile':'_wp_scripts/ArrowPointerStyle1.swf','NHz':0,'NDn':0,'NHzM':0,'NMOff':0,'NEqlSz':true,'NBSpc':50,'NDv':false,'NDvCl':'0x000080','NDvSz':7,'NTm':500,'NFll':true,'NCl':'0xc97d38','NShp':1,'NGdt':4,'NShdw':1,'NHPd':7,'NVPd':7,'NBkCol':'transparent','MBShp':1,'MBGdt':3,'MBFll':true,'MBAnFll':false,'MBCl':'0x000000','MBHvCl':'0x777777','MBCrCl':'0x777777','MBAp':0,'MBHvAp':100,'MBLn':true,'MBLnCl':'0x000080','MBTxCl':'0x000000','MBTxHvCl':'0xffffff','MBTxCrCl':'0xffffff','MBTxFt':3,'MBTxSz':30,'MBTxAl':1,'MBTxBd':false,'MBHPd':5,'MBTPd':5,'MBBPd':5,'SMPd':7,'SMFll':true,'SMCl':'0xeef7f7','SMGdt':4,'SMShp':1,'SMBShp':1,'SMBGdt':3,'SMBFll':true,'SMBAnFll':false,'SMBCl':'0xeef7f7','SMBHvCl':'0x777777','SMBCrCl':'0x777777','SMBAp':0,'SMBHvAp':100,'SMBLn':false,'SMBLnCl':'0x777777','SMBTxCl':'0x777777','SMBTxHvCl':'0xffffff','SMBTxCrCl':'0xffffff','SMBTxFt':0,'SMBTxSz':11,'SMBTxAl':0,'SMBTxBd':false,'SMBHPd':3,'SMBTPd':2,'SMBBPd':2,'AM':true,'AStTyp':5,'AStGlw':'0xffffff'});
				} 
				catch(e)
				{
					document.write( 'There was an error generating the navbar:<br>' + e.message );
				}
				--></script>
			</div>
			<div id="flashgallery_2" style="position:absolute; left:11px; top:33px; width:478px; height:254px;">
				<script type="text/javascript">
				<!--
				var hasReqestedVersion = DetectFlashVer(8, 0, 0);
				if (hasReqestedVersion)
				{
					AC_FL_RunContent(
						"src", "_wp_generated/Full Size Images With Control Bar?flashvar1=7116.xml",
						"base", "_wp_generated",
						"play", "true",
						"loop", "true",
						"width", "478",
						"height", "254",
						"salign", "C",
						"scale", "ShowAll",
						"id", "flashgallery_2",
						"quality", "High",
						"wmode", "transparent",
						"name", "flashgallery_2",
						"type", "application/x-shockwave-flash",
						'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
						"pluginspage", "http://www.macromedia.com/go/getflashplayer"
					);
				}
				else
				{
					var alternateContent = 'An old version of the Flash plugin was detected. <strong><a href="http://www.macromedia.com/go/getflash/">Please upgrade your Flash plugin.<\/a><\/strong>';
					document.write(alternateContent);
				}
				-->
				</script>
			</div>
			<div style="position:absolute; left:1px; top:724px; width:221px; height:67px;">
				<a href="http://www.facebook.com/atouchofmoore"  target="_blank"><img src="_wp_generated/wpe74d8bde.png" width="221" height="67" border="0" id="pic_48" name="pic_48" title="" alt="" onload="OnLoadPngFix()"></a></div>
			<div style="position:absolute; left:618px; top:26px; width:49px; height:40px;">
				<a href="http://www.facebook.com/atouchofmoore"  target="_blank"><img src="_wp_generated/wpd187d441.png" width="49" height="40" border="0" id="pic_49" name="pic_49" title="" alt="" onload="OnLoadPngFix()"></a></div>
			<div style="position:absolute; left:691px; top:22px; width:50px; height:49px;">
				<a href="http://twitter.com/#!/Atouchofmoore"  target="_blank"><img src="_wp_generated/wp84e76f31_05.jpg" width="50" height="49" border="0" id="pic_50" name="pic_50" title="" alt=""></a></div>
			<div style="position:absolute; left:764px; top:23px; width:44px; height:43px;">
				<a href="http://www.linkedin.com/in/dinnettmoore"  target="_blank"><img src="_wp_generated/wpd36e6243.png" width="44" height="43" border="0" id="pic_51" name="pic_51" title="" alt="" onload="OnLoadPngFix()"></a></div>
			<div id="txt_78_C01" style="position:absolute; left:252px; top:359px; width:674px; height:419px;">
				<div class="Normal_P">
					<span class="Normal_C">
<?php
$root = './';
define("in_cert", true);
require($root .'includes/functions.php');

// let's prep for the main loop, and get the highest value of 
// the certificate ids from the database
$con = mysql_connect($mysql_server, $mysql_user, $mysql_pass, $new_link = false, $client_flags = 0);
if (!con);
{
	die(mysql_error());
}
mysql_select_db($mysql_db_name, $con);
$sql = 'SELECT MAX cert_id FROM certificates';
$result = mysql_query($sql);
if (!result)
{
	die(mysql_error());
}
/* TABLE SETUP:
cert_id | cert_amount | cert_payer | cert_redeamed
*/
$cert_id = $result[0]; // this will give only the certificate ID that we need
$mode;
if ($_GET["mode"] != NULL)
{
	$mode = $_GET["mode"];
}
else
{
	$mode = 0;
}

//let's do the loop in a series of modes
switch($mode)
{
	//stage 1: Decide how many certificates are needed
	case 0:
	default:
	?>
		<form action="certificate.php" method="get">
			Number of Desired Gift Certificates:&nbsp;
			<input type="select" name="cert_num">
				<option selected=>1</option>
				<option>2</option>
				<option>3</option>
				<option>4</option>
				<option>5</option>
			</input>				
			<br />
			<br /><!-- link right back to this page, but change to mode 1 (step 2) -->
			<center><input type="submit" name="Submit" href="certificate.php?mode=1" />&nbsp;&nbsp;<input type="submit" name="Cancel" href="index.html" /></center>
		</form>
	<?php
		break;

This is just a part of my file, but it's not displaying anything.You can see what it's doing here.

I tried the

<?php phpinfo(); ?> trick, and that worked. I have no idea on what's stopping this from working. Anyone able to tell?

If you are going to debug it then you need to be methodical. I would start by putting an echo "test"; on a new line after line 166 and trying it. If that works, then I'd be suspicious of your Require on line 169. If there is an error in the included file, it can cause it to stop at that point. If you put another echo at line 170 and that doesn't work, it gives you a pretty good indication. Another thing that you can do is to put an error_reporting(E_ALL); after line 166 in case there are errors that aren't being reported. Start with those and see what you get.

I changed the require to include, then I put the error_reporting(E_ALL); in there, and I put the echo in before everything else, and it's only showing the echo.

I had a warning that my define constant was already declared in functions.php, so I enclosed it in a conditional statement. That got rid of the warning, but it's still not outputting the HTML. Only the echo before everything else that I did.

Anyone have any other ideas on this?

Ok, so I fixed the original problem with taking the switch statement out and separating each segment into separate files and setting the form to automatically go to the next step in the process. Now that I have the first step fixed, and submitting properly, the second step is not displaying. This time around I don't have a switch statement. Here's the code to my second stage of my program:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en-us">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="Generator" content="Serif WebPlus X4 (12.0.4.031)">
	<title>A Touch of Moore</title>
	<meta name="keywords" content="Massage, Massage Therapy, Swedish massage, Waxing, Hair removal, beauty, salon, spa, day spa, hot stone, pedi, pedicure, manicure, permanent makeup, chemical peel, peels, facial, body treatment, Norwich, NY, New York, Chenango County, Massage, Massage Therapy, Swedish massage, Waxing, Hair removal, beauty, salon, spa, day spa, hot stone, pedi, pedicure, manicure, permanent makeup, chemical peel, peels, facial, body treatment, Norwich, NY, New York, Chenango County">
	<meta name="description" content="Norwich, NY Massage Therapy, Swedish Massage, ">
	<meta name="author" content="Dinnett Moore">
	<meta http-equiv="Content-Language" content="en-us">
	<link rel="icon" href="favicon.ico" type="image/x-icon">
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
	<script type="text/javascript" src="_wp_scripts/jsNavBarFuncs.js"></script>
	<script type="text/javascript" src="_wp_scripts/global_navtree.js"></script>
	<script type="text/javascript" src="_wp_scripts/wp_navbar_flash.js"></script>
	<style type="text/css">
	<!--
		body {margin: 0px; padding: 0px;}
		a:link {color: #000080;}
		a:visited {color: #000080;}
		a:hover {color: #000080;}
		a:active {color: #000080;}
		.Normal-P
		{
			margin:0.0px 0.0px 10.0px 0.0px; text-align:left; font-weight:400; 
        }
		.Normal-P0
		{
			margin:7.0px 0.0px 7.0px 0.0px; text-align:left; font-weight:400; 
        }
		.Normal-P1
        {
			margin:7.0px 0.0px 7.0px 0.0px; text-align:left; font-weight:400; 
			text-indent:32.0px; 
        }
		.Normal-P2
        {
			margin:7.0px 0.0px 7.0px 0.0px; text-align:left; font-weight:400; 
			text-indent:33.0px; 
        }
		.Normal-P3
        {
			margin:0.0px 0.0px 0.0px 0.0px; text-align:left; font-weight:400; 
			text-indent:33.0px; 
        }
		.Normal-P4
        {
			margin:0.0px 0.0px 0.0px 0.0px; text-align:left; font-weight:400; 
        }
		.Normal-P5
        {
			margin:0.0px 0.0px 0.0px 53.0px; text-align:left; font-weight:400; 
			text-indent:-20.0px; 
        }
		.Normal-C
        {
			font-family:"Arial", sans-serif; font-weight:700; font-size:20.0px; 
			line-height:1.25em; 
        }
		.Normal-C0
        {
			font-family:"Arial", sans-serif; font-size:16.0px; line-height:1.19em; 
        }
		.Normal-C1
        {
			font-family:"Arial", sans-serif; font-size:18.0px; line-height:1.22em; 
        }
		.Normal-C2
        {
			font-family:"Arial", sans-serif; font-size:13.0px; line-height:1.23em; 
        }
		.Normal-C3
        {
			font-family:"Arial", sans-serif; font-size:15.0px; line-height:1.13em; 
        }
		.Normal-C4
        {
			font-family:"Wingdings", serif; font-size:15.0px; line-height:1.07em; 
        }
		.Normal-C5
        {
			font-family:"Arial", sans-serif; font-size:15.0px; line-height:1.13em; 
			color:#0000ff; text-decoration: underline; 
        }
		.Body-C
        {
			font-family:"Times New Roman", serif; font-size:13.0px; 
			line-height:1.23em; color:#777777; 
        }
		-->
	</style>
	<script type="text/javascript" src="_wp_scripts/jsFlashVer.js"></script>
	<script type="text/javascript" src="_wp_scripts/jspngfix.js"></script>
	<script type="text/javascript"><!--
	var blankSrc = "_wp_scripts/blank.gif";
	--></script>
	</head>
	<body text="#000000" style="background-color:#f3f3e4; text-align:center; height:1000px;">
		<div style="background-color:transparent;text-align:left;margin-left:auto;margin-right:auto;position:relative;width:950px;height:1000px;">
		<div style="position:absolute; left:500px; top:68px; width:438px; height:283px;">
			<img src="_wp_generated/wpb07d38a0.png" width="438" height="283" border="0" id="pic_18" name="pic_18" title="" alt="" onload="OnLoadPngFix()"></div>
			<div id="nav_322" style="position:absolute; left:10px; top:350px; width:208px; height:356px; z-index:200;">
				<script type="text/javascript" id="nav_322_script"><!--
				try 
				{
					var navtree_nav_322 = WpNavBar.getNavTreeTopLevel( global_navtree, {m_sThisPageUrl:'index.html',
					m_sNavBarTarget:'_self',
					m_bIncludeAnchors:false,
					m_bFlash:true,
					m_bIncludeChildren:true,
					m_bHideCurrent:false} );
					if( !navtree_nav_322 ) 
						throw WpNavBar.getErrorObj( 'Link tree could not be read' );
					var nav_322 = new wp_navbar_flash("nav_322", navtree_nav_322, {'ExportNoScript':false,m_iWidth:208,
					m_iHeight:356,'pageCol':'#f3f3e4'}, {'sFlashFile':'_wp_scripts/ArrowPointerStyle1.swf','NHz':0,'NDn':0,'NHzM':0,'NMOff':0,'NEqlSz':true,'NBSpc':50,'NDv':false,'NDvCl':'0x000080','NDvSz':7,'NTm':500,'NFll':true,'NCl':'0xc97d38','NShp':1,'NGdt':4,'NShdw':1,'NHPd':7,'NVPd':7,'NBkCol':'transparent','MBShp':1,'MBGdt':3,'MBFll':true,'MBAnFll':false,'MBCl':'0x000000','MBHvCl':'0x777777','MBCrCl':'0x777777','MBAp':0,'MBHvAp':100,'MBLn':true,'MBLnCl':'0x000080','MBTxCl':'0x000000','MBTxHvCl':'0xffffff','MBTxCrCl':'0xffffff','MBTxFt':3,'MBTxSz':30,'MBTxAl':1,'MBTxBd':false,'MBHPd':5,'MBTPd':5,'MBBPd':5,'SMPd':7,'SMFll':true,'SMCl':'0xeef7f7','SMGdt':4,'SMShp':1,'SMBShp':1,'SMBGdt':3,'SMBFll':true,'SMBAnFll':false,'SMBCl':'0xeef7f7','SMBHvCl':'0x777777','SMBCrCl':'0x777777','SMBAp':0,'SMBHvAp':100,'SMBLn':false,'SMBLnCl':'0x777777','SMBTxCl':'0x777777','SMBTxHvCl':'0xffffff','SMBTxCrCl':'0xffffff','SMBTxFt':0,'SMBTxSz':11,'SMBTxAl':0,'SMBTxBd':false,'SMBHPd':3,'SMBTPd':2,'SMBBPd':2,'AM':true,'AStTyp':5,'AStGlw':'0xffffff'});
				} 
				catch(e)
				{
					document.write( 'There was an error generating the navbar:<br>' + e.message );
				}
				--></script>
			</div>
			<div id="flashgallery_2" style="position:absolute; left:11px; top:33px; width:478px; height:254px;">
				<script type="text/javascript">
				<!--
				var hasReqestedVersion = DetectFlashVer(8, 0, 0);
				if (hasReqestedVersion)
				{
					AC_FL_RunContent(
						"src", "_wp_generated/Full Size Images With Control Bar?flashvar1=7116.xml",
						"base", "_wp_generated",
						"play", "true",
						"loop", "true",
						"width", "478",
						"height", "254",
						"salign", "C",
						"scale", "ShowAll",
						"id", "flashgallery_2",
						"quality", "High",
						"wmode", "transparent",
						"name", "flashgallery_2",
						"type", "application/x-shockwave-flash",
						'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
						"pluginspage", "http://www.macromedia.com/go/getflashplayer"
					);
				}
				else
				{
					var alternateContent = 'An old version of the Flash plugin was detected. <strong><a href="http://www.macromedia.com/go/getflash/">Please upgrade your Flash plugin.<\/a><\/strong>';
					document.write(alternateContent);
				}
				-->
				</script>
			</div>
			<div style="position:absolute; left:1px; top:724px; width:221px; height:67px;">
				<a href="http://www.facebook.com/atouchofmoore"  target="_blank"><img src="_wp_generated/wpe74d8bde.png" width="221" height="67" border="0" id="pic_48" name="pic_48" title="" alt="" onload="OnLoadPngFix()"></a></div>
			<div style="position:absolute; left:618px; top:26px; width:49px; height:40px;">
				<a href="http://www.facebook.com/atouchofmoore"  target="_blank"><img src="_wp_generated/wpd187d441.png" width="49" height="40" border="0" id="pic_49" name="pic_49" title="" alt="" onload="OnLoadPngFix()"></a></div>
			<div style="position:absolute; left:691px; top:22px; width:50px; height:49px;">
				<a href="http://twitter.com/#!/Atouchofmoore"  target="_blank"><img src="_wp_generated/wp84e76f31_05.jpg" width="50" height="49" border="0" id="pic_50" name="pic_50" title="" alt=""></a></div>
			<div style="position:absolute; left:764px; top:23px; width:44px; height:43px;">
				<a href="http://www.linkedin.com/in/dinnettmoore"  target="_blank"><img src="_wp_generated/wpd36e6243.png" width="44" height="43" border="0" id="pic_51" name="pic_51" title="" alt="" onload="OnLoadPngFix()"></a></div>
			<div id="txt_78_C01" style="position:absolute; left:252px; top:359px; width:674px; height:419px;">
				<div class="Normal_P">
					<span class="Normal_C">
					<form action="certificate_stage3.php" method="get">
					<?php
// prep the database

$root = './';
include($root ."includes/functions.php");
$con = mysql_connect($mysql_server, $mysql_user, $mysql_pass, $new_link = false, $client_flags = 0);
if (!$con);
{
	die(mysql_error());
}
mysql_select_db($mysql_db_name, $con);
$i = 0;
$cert_num = $_GET["cert_num"];
?>
<?php
		while($i <= $cert_num)
		{
		?>Certificate <?php echo $i+1; ?>:
		<?php
			$j = 0;
			$sql = "SELECT MAX serviceID FROM services";
			$result = mysql_query($sql);
			if (!$result)
			{
				die(mysql_error());
			}
			/*
			table setup:
			serviceID | serviceName | serviceAmount
			*/
			?>
			 
					<select name="certAmount">
			<?php
			while($j <= $result[0])
			{
				$sql = "SELECT * FROM services WHERE serviceID = '$j'";
				$result2 = mysql_query($sql);
				if (!$result2)
				{
					die(mysql_error());
				}
				?>
				<option value="<?php echo $result2[2]; ?>"><?php echo($result2[1]); ?>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $result2[2]; ?></option>
				<?php
				$j++;
			}
			?>
			</select>
			<br />
			<?php
			$i++;	
		} // This does every certificate option for each certificate that the user requests all at once
		?><br />
			<center><input type="button" name="Back"  />&nbsp;<input type="submit" name="Submit" onclick="this.form.submit();" />
		<?php
		mysql_close($con);
		?>
		&nbsp;<input type="button" name="Cancel" href="index.html"></center></form><br />
				</span>
			</div>
		</div>
<div style="position:absolute; left:629px; top:760px; width:311px; height:205px;">
    <img src="_wp_generated/wpd4f88c72_05.jpg" width="311" height="205" border="0" id="pic_20" name="pic_20" title="" alt=""></div>
<div style="position:absolute; left:370px; top:767px; width:147px; height:79px;">
    <a href="http://commercechenango.com"  target="_blank"><img src="_wp_generated/wp6db46daa_05.jpg" width="147" height="79" border="0" id="pic_46" name="pic_46" title="" alt=""></a></div>
<div style="position:absolute; left:158px; top:867px; width:259px; height:58px;">
    <a href="http://www.shopnorwichny.com/"  target="_blank"><img src="_wp_generated/wp3c237bdf_05.jpg" width="259" height="58" border="0" id="pic_47" name="pic_47" title="" alt=""></a></div>
</div>
</body>
</html>

I'm not sure what's going on.

Member Avatar for diafol

How about taking out all that js horribleness and just leave the html/php

So, from what I can glean, this is what you have:

<?php
// prep the database
 
$root = './';
include($root ."includes/functions.php");
$con = mysql_connect($mysql_server, $mysql_user, $mysql_pass, $new_link = false, $client_flags = 0);
if (!$con);
{
	die(mysql_error());
}
mysql_select_db($mysql_db_name, $con);
$i = 0;
$cert_num = $_GET["cert_num"];
?>
<?php
		while($i <= $cert_num)
		{
		?>Certificate <?php echo $i+1; ?>:
		<?php
			$j = 0;
			$sql = "SELECT MAX serviceID FROM services";
			$result = mysql_query($sql);
			if (!$result)
			{
				die(mysql_error());
			}
			/*
			table setup:
			serviceID | serviceName | serviceAmount
			*/
			?>
 
					<select name="certAmount">
			<?php
			while($j <= $result[0])
			{
				$sql = "SELECT * FROM services WHERE serviceID = '$j'";
				$result2 = mysql_query($sql);
				if (!$result2)
				{
					die(mysql_error());
				}
				?>
				<option value="<?php echo $result2[2]; ?>"><?php echo($result2[1]); ?>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $result2[2]; ?></option>
				<?php
				$j++;
			}
			?>
			</select>
			<br />
			<?php
			$i++;	
		} // This does every certificate option for each certificate that the user requests all at once
		?><br />
			<center><input type="button" name="Back"  />&nbsp;<input type="submit" name="Submit" onclick="this.form.submit();" />
<?php
   mysql_close($con);
?>

It's a bit of a mess with all the html and php and inline js mixed in.

SELECT MAX serviceID FROM services

should be

SELECT MAX(serviceID) FROM services

This should give you a single value in a single 'row', e.g. 46

while($j <= $result[0])

won't work as $result[0] is not an array, it's a resource. You need to do mysql_fetch_array($result) or similar to get the array.

Anyway, didn't get further than that...

This is what I have without the header (used just for template integration, I did NOT write the header).

<?php
// prep the database

$root = './';
include($root ."includes/functions.php");
$con = mysql_connect($mysql_server, $mysql_user, $mysql_pass, $new_link = false, $client_flags = 0);
if (!$con);
{
	die(mysql_error());
}
mysql_select_db($mysql_db_name, $con);
$i = 0;
$cert_num = $_GET["cert_num"];
		while($i <= $cert_num)
		{
		?>Certificate <?php echo $i+1; ?>:
		<?php
			$j = 0;
			$sql = "SELECT MAX(serviceID) FROM services";
			$result = mysql_query($sql);
			if (!$result)
			{
				die(mysql_error());
			}
			$service_id_num = mysql_fetch_array($result);
			/*
			table setup:
			serviceID | serviceName | serviceAmount
			*/
			?>
			 
					<select name="certAmount">
			<?php
			while($j <= $service_id_num[0])
			{
				$sql = "SELECT * FROM services WHERE serviceID = '$j'";
				$result2 = mysql_query($sql);
				if (!$result2)
				{
					die(mysql_error());
				}
				$services = mysql_fetch_array($result2);
				?>
				<option value="<?php echo $services[2]; ?>"><?php echo $services[1]; ?>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $services[2]; ?></option>
				<?php
				$j++;
			}
			?>
			</select>
			<br />
			<?php
			$i++;	
		} // This does every certificate option for each certificate that the user requests all at once
		?><br />
			<center><input type="button" name="Back"  />&nbsp;<input type="submit" name="Submit" onclick="this.form.submit();" />
		<?php
		mysql_close($con);
		?>
Member Avatar for diafol

OK, so what's happening now?

It's still not displaying the HTML output.

Okay, so I got the second part to display the output (it didn't like my database connection code), but now, I'm having issues with it submitting each value from the select options for each certificate. Anyone have any pointers on how to do this?

Member Avatar for diafol

I've tidied this up (to my liking - don'ttake offence):

<?php
        $output = "";
	$i = 0;
	$cert_num = intval($_GET["cert_num"]);
	while($i <= $cert_num){
		$output .= "<label>Certificate " . ($i+1) . ":</label>";
		$j = 0;
		$result = mysql_query("SELECT MAX(serviceID) FROM services")or die(mysql_error());
		$service_id_num = mysql_fetch_array($result); //this is the same no. every time!
		$output .= '<select name="certAmount">';
		while($j <= $service_id_num[0]){
			$result2 = mysql_query("SELECT * FROM services WHERE serviceID = '$j'")or die(mysql_error());
			$services = mysql_fetch_array($result2);
			$output .= "<option value=\"{$services[2]}\">{$services[1]}:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$services[2]}</option>";
			$j++;
		}
		$output .= "</select><br />";
		$i++;	
	}
?>

What I don't understand is the first loop. You seem to be retrieving the same value every time (MAX(serviceID))? Is this right?

Also, you'll get a number of select fields of the same name (certAmount)

This is supposed to do a select field for each certificate that the user chooses. Each value is going to be submitted as an individual value within the URL hence method="get"

The first loop is the certificate, where the second loop is the options that the user has to choose from for the value of the certificate.

So you get something like this:

Certificate 1: Option1
               option2
               option3
Certificate 2: Option1
               option2
               option3
Member Avatar for diafol

OK I think I've got it:

$no_certs = intval($_GET['cert_num']);
$options = "";
$r = mysql_query("SELECT `serviceID`,`serviceName`,`serviceAmount` FROM services")or die(mysql_error());"
if(mysql_num_rows($r) > 0){
  while($d = mysql_fetch_array($r)){
    $options .= "\n\t<option value=\"{$services[2]}\">{$services[1]}:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$services[2]}</option>";
  }
}
for($x=0;$x<$no_certs;$x++){
  $cert = "cert" . ($x+1);
  echo "\n<label for=\"$cert\">Certificate$cert : </label>\n<select name=\"cert[]\" id=\"$cert\">$options</select>\n<br />";
}

Not tested.

This seems to be well written, but the .= thing gives an error and stops the code from running, and once I had that fixed, it never pulled anything from the DB.

Member Avatar for diafol

sorry

$options .= "\n\t<option value=\"{$services[2]}\">{$services[1]}:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$services[2]}</option>";

should be

$options .= "\n\t<option value=\"{$d[2]}\">{$d[1]}:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$d[2]}</option>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.