Thanks Nogdog; foolishly I forgot to post the actual code that I'm refering to. I'll put it in this time.
As you'll see my html is completely separate from the bulk of the php. So how do I get it to conditionally run the html or alternate, or is the answer just to put ALL html into a massive string variable?
code!
<?php session_start();
include 'link.php' ; // include the link
// get the input form data
if ($_POST) {
foreach($_POST as $k => $v) {
$v = trim($v);
$$k = $v;
}
//build the cleaning array
$nononchar = array(" ", "(", ")", "[", "]", "-", ".", ",", "#") ;
//clean the phone number
$telno = str_replace($nononchar, "", $telno);
//clean the postcode
$postcode = str_replace($nononchar, "", $postcode);
$expire=time()+60*60*24*30;
setcookie("telno", $telno, $expire);
$select = "SELECT CustomerID, EmailAddress, ContactFirstName, ContactLastName FROM Clients WHERE PostalCode='$postcode' && PhoneNumber='$telno' "; //build the query
$result = mysqli_query($link,$select); //execute select query
// check to see if a result is returned
if (mysqli_num_rows($result) < 1) {
echo "You don't seem to be in our database - Click here to enter your details";
} else {
$row = mysqli_fetch_array($result);
$CustomerID = $row['CustomerID'];
$ContactFirstName = $row['ContactFirstName'];
$ContactLastName = $row['ContactLastName'];
$EmailAddress = $row['EmailAddress'];
$InitialLastName = substr($ContactLastName,0,1) . "*******" ;
$FullName = "$ContactFirstName $ContactLastName" ;
//store session data
$_SESSION['FullName'] = $FullName;
$_SESSION['Initial'] = $ContactFirstName . " " . $InitialLastName;
$_SESSION['EmailAddress'] = $EmailAddress;
$_SESSION['telno'] = $telno;
}
//Now lets get the pets
$petselect = "SELECT ProjectID, BoardersName, Boardertype FROM ClientsPets WHERE CustomerID='$CustomerID' ";
$petresult = mysqli_query($link, $petselect);
}
?>
<HTML>
<STYLE>
table
{
margin-left: auto;
margin-right: auto;
}
P
{
font-family:"Verdana", Times, serif;
}
TH
{
font-family:"Verdana", Times, serif;
}
TD
{
font-family:"Verdana", Times, serif;
}
</STYLE>
<body>
<div align="center">
<FORM METHOD="POST" ACTION="makebooking.php" name="bookingform">
<INPUT TYPE=HIDDEN NAME="CustomerID" Value="<? echo $CustomerID ?> ">
<TABLE BORDER="1">
<TH COLSPAN="3">Request A Booking</TH>
<TR>
<TH>Customer ID</TH> <TH>First Name</TH><TH>Last Name</TH>
</TR>
<TR>
<TD><? echo $CustomerID ?></TD> <TD><? echo $ContactFirstName ?> </TD> <TD> <? echo $InitialLastName ?> </TD>
</TR>
</TABLE>
<BR>
<HR>
<BR>
<TABLE>
<TR>
<TD>
<P> Click the pets you'd like to request booking for (use the 'control' button to select multiple pets):
</TD>
<TD>
<SELECT multiple="yes" NAME="SelectPet[]">
<?
while ($rowtwo = mysqli_fetch_array($petresult)) {
$ProjectID = $rowtwo['ProjectID'];
$BoardersName = $rowtwo['BoardersName'];
$Boardertype = $rowtwo['Boardertype'];
echo "<OPTION VALUE=$ProjectID> $BoardersName the $Boardertype </OPTION>";
} ?>
</SELECT>
</TD>
</TR>
<TR>
</TR>
</TABLE>
<HR>
</BR>
<TABLE border="1">
<TR><TH COLSPAN="6" style="text-align:center">Booking Dates</TH>
</TR>
<TR>
<TH COLSPAN="3">Arrival</TH><TH COLSPAN="3">Checkout</TH>
</TR>
<TD>
<SELECT NAME="InDate">
<?
//back to php for counting dates
$startcounter = 1;
$endcounter = 32;
while ($startcounter < $endcounter) {
echo "<OPTION VALUE= $startcounter > $startcounter </OPTION>";
$startcounter++;
}
?>
</SELECT>
</TD>
<TD>
<SELECT NAME="InMonth">
<OPTION VALUE=01> January </OPTION>
<OPTION VALUE=02> February </OPTION>
<OPTION VALUE=03> March </OPTION>
<OPTION VALUE=04> April </OPTION>
<OPTION VALUE=05> May </OPTION>
<OPTION VALUE=06> June </OPTION>
<OPTION VALUE=07> July </OPTION>
<OPTION VALUE=08> August </OPTION>
<OPTION VALUE=09> September </OPTION>
<OPTION VALUE=10> October </OPTION>
<OPTION VALUE=11> November </OPTION>
<OPTION VALUE=12> December </OPTION>
</SELECT>
</TD>
<TD>
<SELECT NAME="InYear">
<OPTION VALUE=2011> 2011 </OPTION>
<OPTION VALUE=2012> 2012 </OPTION>
</SELECT>
-
</TD>
<TD>
-
<SELECT NAME="OutDate">
<?
//back to php for counting dates
$startcounter = 1;
$endcounter = 32;
while ($startcounter < $endcounter) {
echo "<OPTION VALUE= $startcounter > $startcounter </OPTION>";
$startcounter++;
}
?>
</SELECT>
</TD>
<TD>
<SELECT NAME="OutMonth">
<OPTION VALUE=01> January </OPTION>
<OPTION VALUE=02> February </OPTION>
<OPTION VALUE=03> March </OPTION>
<OPTION VALUE=04> April </OPTION>
<OPTION VALUE=05> May </OPTION>
<OPTION VALUE=06> June </OPTION>
<OPTION VALUE=07> July </OPTION>
<OPTION VALUE=08> August </OPTION>
<OPTION VALUE=09> September </OPTION>
<OPTION VALUE=10> October </OPTION>
<OPTION VALUE=11> November </OPTION>
<OPTION VALUE=12> December </OPTION>
</SELECT>
</TD>
<TD>
<SELECT NAME="OutYear">
<OPTION VALUE=2011> 2011 </OPTION>
<OPTION VALUE=2012> 2012 </OPTION>
</SELECT>
</TD>
</TR>
</TABLE>
<TABLE>
<TR>
<TD COLSPAN="4">
Do you plan to collect your pet in the morning or afternoon? <br>
</TD>
<TD >
<input type="radio" name="pickup" value="AM" checked>Before MidDay<br>
<input type="radio" name="pickup" value="PM">After MidDay<br>
</TD>
</TR>
</TABLE>
<INPUT TYPE ="SUBMIT" VALUE="Request Booking" />
</FORM>
</DIV>
<HR>
</body>
</HTML>