Page 1 of 1

i cant seem to get this to work.

Posted: Fri Nov 21, 2003 4:29 pm
by unclematty
i cant seem to get this to work. I am passing a variable via a querystring and evalulating it. if it reads, "resume" show this table. else, show that table...

--------
<?php
$formtype = $HTTP_SERVER_VARS['QUERY_STRING'];
?>

<!-- Begin: Form Data Confirmation Table -->
<?php
if ($formtype = "resume") {
?>
<table width="600px" bgcolor="ffffff" cellpadding="1" cellspacing="1">
<tr><td bgcolor="999999"><b>&nbsp;&nbsp;Form Submit Confirmation</b></td></tr>
<tr><td bgcolor="#ffffff" >
<table width="100%" bgcolor="#00CC00" cellpadding="10" cellspacing="1">
<tr><td bgcolor="ffffff" style="color:#000000">&nbsp;&nbsp;
<?php echo "Your $formtype has been received. A Top Shelf
Representavie will be in touch shortly" ?>.</b></td></tr>
</table>
</td></tr>
</table>
<?php
}
else
{
?>
<table width="600px" bgcolor="ffffff" cellpadding="1" cellspacing="1">
<tr><td bgcolor="999999"><b>&nbsp;&nbsp;Form Submit Confirmation</b></td></tr>
<tr><td bgcolor="#ffffff" >
<table width="100%" bgcolor="#00CC00" cellpadding="10" cellspacing="1">
<tr><td bgcolor="ffffff" style="color:#000000">&nbsp;&nbsp;
<?php echo "Your $formtype has been received. Thank you very much" ?>.</b></td></tr>
</table>
</td></tr>
</table>
<?php
}
?>


<!-- Begin: Form Data Confirmation Table -->

Posted: Fri Nov 21, 2003 4:34 pm
by infolock
so, what exactly isn't working with it. what errors are you getting. what is the tables doing that you don't want them to do?

Posted: Sat Nov 22, 2003 10:21 am
by ghost007
hi,

you must use double equal signs when checking vars in PHP.

So try:
if ($formtype == "resume") {

good luck
Siech

Posted: Sat Nov 22, 2003 11:09 am
by DuFF
$formtype = $HTTP_SERVER_VARS['QUERY_STRING'];

I think would be better written as:

Code: Select all

<?php
 $formtype = $_GET['formtype'];  
//where 'formtype' is the URL query string
// Ex: http://www.example.com/index.php?formtype=resume
?>