if statement question

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
User avatar
chopper_pc
Forum Newbie
Posts: 15
Joined: Fri May 30, 2008 10:55 pm

if statement question

Post by chopper_pc »

Im trying to write a script that takes two post values from drop down forms on the previous page and sets a variable to be used in the "action" part of a form on the page to control direction of the submit. The purpose is the value of the drop downs is zero if not used, I want to change the direction of the page if both drop downs are not used.

Code: Select all

 
$id1=$_POST['id1'];
$id2=$_POST['id2'];
if($id1 == 0 and $id2 == 0) {
$action="foo";
    } else {
$action="foo2";
blablabla
<form action="<? echo $action?>.php" method="post">
    }
I don't know what i'm missing but the script is going to foo2 even if both values are 0.
I have confirmed the values posted are 0 by echoing them in the page.
Is there somthing simple I am missing?
User avatar
aditya2071990
Forum Contributor
Posts: 106
Joined: Thu May 22, 2008 11:30 am
Location: Hyderabad, India
Contact:

Re: if statement question

Post by aditya2071990 »

The else's ending brace is after the form tag... maybe that's the problem?
Post Reply