Forum Moderators: coopster

Message Too Old, No Replies

multi page form - trying to output variables in HTML?

         

mpearson55

6:23 pm on Feb 16, 2006 (gmt 0)

10+ Year Member



Hey all!

I am trying to impliment a simple multi page form with fieldforwarder included. On my page two, I am basically confirming their input in html form.. The code for each variable is this:

<?php echo $realname;?>

Which works great, except when I go inside an IF command.. (my IF command works just fine)

if ( $listingtype == Basic ) {
echo "
Basic Listing info for: <?php echo $businessname;?>
";

I am not a PHP expert, so my simple attributes could be off, but could anyone come up with a reason why it is not working?

Thanks again!
-Matt

dreamcatcher

11:29 pm on Feb 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Matt,

Sorry, but I have read that post over and over and have no idea what you are trying to say. LOL.

I assume you are enclosing the value in your if statement in quotes?

if ( $listingtype == 'Basic' )

?

dc

mpearson55

11:57 pm on Feb 16, 2006 (gmt 0)

10+ Year Member



Hahaha - Im sorry!

Ok - So I have a PHP form - But I have some if commands -- and for whatever reason, the variables are showing *outside* of the if command, but not inside...

If I print <?php echo $realname;?> plainly in the file, it will print the results (with the help of fieldforwarder, it will take the form data and create the variable '$realname') just fine -- however, when I try to use that variable inside of my 'IF', it simply doesn't output anything.

if ( $listingtype == Basic ) {
echo "
Basic Listing info for: <?php echo $realname;?>
";

Im trying to figure out why this is.. but perhaps more information is needed?

THanks!

sonjay

2:17 am on Feb 17, 2006 (gmt 0)

10+ Year Member



It looks to me like you're trying to echo within an echo. Try this:

if ( $listingtype == 'Basic' ) {
echo "Basic Listing info for: $realname";
}

coopster

1:34 pm on Feb 17, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Spot on sonjay. Nice catch. And welcome to WebmasterWorld, mpearson55.