If statement throws error?

I don’t understand why this if statement throws an error


<?php
if(!isset($_POST['submit'])) || (!isset($_GET['cform']))) { 
?>

the error, http://offthevinesd.com/lukescontact.php

Thanks…

Let’s separate the terms.


<?php
if(
    !isset($_POST['submit'])) ||
    (!isset($_GET['cform']))
) { 
?>

Do you see where the bracket needs to go?

Some code editors have a nice feature where if you put the cursor on an opening parenthesis, it will highlight it, as well as the closing parenthesis. This makes it real easy to spot where you have the wrong number of parenthesis, and even just plain mismatched them.

notepad++ is a pretty simple editor with this capability.

jeez… dreamweaver sux…

k, I dont see why my if statements dond see to be working.
What I’m tryin to makle happen is if the form hasn’t been submitted or the $_GET[‘cform’] is missing, then the form will display.
But once the form is submitted, the javascript thing woulod run. Then once the javascript script is run, it suppllies a
$_GET variable and when the page sees that it has been set, it displays a Thank you.
Heres what I have soo far
<?php
if(
(!isset($_POST[‘submit’])) ||
(!isset($_GET[‘cform’]))
) {
?>
<div style=“background-image:url(images/contactform_top.jpg); width:583px; margin:0 auto; height:30px”>
</div>
<div style=“background-image:url(images/contactform_mid.jpg); width:583px; margin:0 auto”>
<form id=“contact” action=“#” method=“post” class=“contact” name=“contact”>
<fieldset><legend>Contact form</legend>
<p class=“first”>
<label for=“name”>Name</label>
<input type=“text” name=“name” id=“name” size=“30” class=“validate[‘required’,‘length[3,-1]’,‘nodigit’]” />
</p>
<p>
<label for=“email”>Email</label>

                &lt;input type="text" name="email" id="email" size="30" class="validate['required','length[5,-1]','email']" /&gt;
            &lt;/p&gt;
            &lt;p&gt;
                &lt;label for="phone"&gt;Phone&lt;/label&gt;

                &lt;input type="text" name="phone" id="phone" size="30" /&gt;
            &lt;/p&gt;
            &lt;p&gt;
                &lt;label for="message"&gt;Message&lt;/label&gt;

                &lt;textarea name="message" id="message" cols="30" rows="10"  class="validate['required']"&gt;&lt;/textarea&gt;
            &lt;/p&gt;                    
            
            &lt;p class="submit"&gt;&lt;button type="submit" class="validate['submit']" name="submit"&gt;Send&lt;/button&gt;&lt;/p&gt;        
                        
        &lt;/fieldset&gt;                    
                    
    &lt;/form&gt;    

</div>
<div style=“background-image:url(images/contactform_bot.jpg); width:583px; margin:0 auto; height:33px; background-color:#000000”>
</div>
<?php
} elseif (isset($_POST[‘submit’])) {
echo ‘<br><br><br><br><br><center>’;
echo ‘<script language=“javascript” src=“/js/timerbar.js”></script>’;
echo ‘</center>’;
} else {
echo ‘<br><br><br><br><br><center>’;
echo ‘<h3>Thank you!</h3>’;
echo ‘</center>’;
}
?>
Thanks

You’ll want to use the && operator instead, so that the condition will be filfilled when neither of them are true.

if (!foo && !bar) {
do baz
}

If you use the || operator, the condition will be filfilled when only one of them is true.


 &&   True False
True   1     0
False  0     0

 ||  True False
True   1     1
False  1     0

oh ok, thanks (again)