Something along these lines:
<?php
require_once('inc/contact.php');
echo "<br>";
// you need to add some code here too add value to $page
if ($adminemail!==NULL) {
printf( "<form action=\"http://www.marketsonline.com.au/contact_m_admin/dynaform/dynaform.php\" method=\"POST\">
<input type=\"hidden\" name=\"rec_mailto\" value=\"%s\">
<input type=\"hidden\" name=\"rec_subject\" value=\"New DynaForm Email\">
<input type=\"hidden\" name=\"rec_thanks\" value=\"http://www.marketsonline.com.au/contact_m_admin/dynaform/thanks.html\">
Name<br><input type=\"text\" name=\"Name\"><br><br>
Email<br><input type=\"text\" name=\"Email\"><br><br>
Comments<br><input type=\"text\" name=\"Phone\"><br><br>
Address<br><input type=\"text\" name=\"Comments\"><br><br>
<input type=\"submit\" value=\"Submit\">
</form>",$page['adminemail']);
}
?>
In the if statement you could try these checks instead:
if ($email!=="") {}
if (strlen($email)>0) {} // if the length of $email is above 0 do something
Heres bigger example that i use on one of my pages. I have a table that displays info from a table, but depending on a parameter i add some extra fields and a form to the table so i can update it as well. It will only add the form and extra fields when $valg=="en".
( \n is not required, it just adds a new line, so the code is more readable when you view the html source after execution)
// more code here
$result=mysql_query("select * from medlemmer order by $order",$link);
if ($valg=="en")
{
echo "<form action=\"oppdater.php\" method=\"POST\">";
$f=12;
}
else
{
$f=15;
}
printf("<TABLE BORDER=\"1\" id=\"table5\" CELLSPACING=\"1\" CELLPADDING=\"1\"
style=\"border: 1px #000000; font-size: %dpx; align=center;\">\n",$f);
echo "<tr>\n";
if ($valg=="en")
{
echo"<td>#</td>\n";
}
echo "<TD> <a href=\"index.php?order=navn\"><b>Navn</b></a></TD>\n<TD> <b>Adresse</b> </TD>\n<TD> <b>Postnr</b> </TD>\n<TD> <b>Poststed</b> </TD>\n<TD> <b>Tlf</b> </TD>\n<TD> <b>Mobil</b> </TD>\n<TD> <b>Epost</b> </TD>\n<TD> <a href=\"index.php\"><b>Verv</b></a> </TD></TR>\n";
while($row = mysql_fetch_array($result))
{
echo "<tr>\n";
if ($valg=="en")
{
printf("<td><input type=\"radio\" name=\"id\" value=\"%d\"></td>\n",$row['id']);
}
printf("<td> %s</td>\n<td> %s </td>\n<td> %s </td>\n<td> %s </td>\n<td> %s </td>\n<td> %s </td>\n<td> %s </td>\n<td> %s </td></tr>\n",$row["navn"],$row["adresse"],$row["postnr"],$row["poststed"],$row["tlf"],$row["mobil"],$row["epost"],$row["posisjon"]);
}
if ($valg=="en")
{
echo "<tr>
<td>Ny: </td>
<td><input type=\"text\" size=\"12\" name=\"navn\"></td>
<td><input type=\"text\" size=\"15\" name=\"adresse\"></td>
<td><input type=\"text\" size=\"7\" name=\"postnr\"></td>
<td><input type=\"text\" size=\"11\" name=\"poststed\"></td>
<td><input type=\"text\" size=\"10\" name=\"tlf\"></td>
<td><input type=\"text\" size=\"10\" name=\"mobil\"></td>
<td><input type=\"text\" size=\"23\" name=\"epost\"></td>
<td><select name=\"pos\">\n
<option value=\"\">\n";
while ($vrow = mysql_fetch_array($vresult))
{
printf("<option value=\"%s\">%s\n",$vrow['posisjon'],$vrow['posisjon']);
}
echo " <tr>\n<td colspan=\"9\" style=\"text-align: center;\"><INPUT TYPE=\"submit\" VALUE=\"OK\"> <INPUT TYPE=\"Reset\" VALUE=\"Reset\"></td>\n</tr>\n";
echo " </select>\n</td>\n
</tr>\n";
}
echo "</table>\n"; //slutt tabel5
if ($valg=="en")
{
echo "</form>\n";
}
Hope this can point you in the right direction.