i cant seem to get this to work.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
unclematty
Forum Newbie
Posts: 2
Joined: Thu Nov 20, 2003 12:52 pm

i cant seem to get this to work.

Post 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 -->
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post 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?
ghost007
Forum Commoner
Posts: 49
Joined: Sat Nov 22, 2003 10:10 am

Post by ghost007 »

hi,

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

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

good luck
Siech
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post 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
?>
Post Reply