PHP code error HELP.
guys guys need your help i'm stuck here..
<?
$error = "http://testmatch.com.sg/attacherror.htm";
if ($attachment == true) { require("attach.php"); } else { $_POST; }
?>
i actually wants this php to detects if there is a attachment attached in the form user submitted if not it will be redirected to the error html page.
<?
$error = "http://testmatch.com.sg/attacherror.htm";
if ($attachment == true) { require("attach.php"); } else { $_POST; }
?>
i actually wants this php to detects if there is a attachment attached in the form user submitted if not it will be redirected to the error html page.
0
Comments
Where is the first instance of the $attachment variable
Also post the error your getting if any and explain in further detail what you want to do and how you have the forms set up. You gave very little information that we can use to help.
1 - to send with attachment / attach.php
2 - to check if there is an attachment in the form submitted / code i pasted.
3 - form in html coding save in .htm
the problem is there isn't any error message at all.
what i wanted was if there is no attachement found in the form submitted it can either redirect to a error page i.e error.htm or to create a dialog box to warn of mandatory attachment to be attached along.
if($_POST != "") { // you can also use $_GET if you choose
// execute attached successful code
} else {
// Failed and display error
}
i place the checking codes in mailprocess.php
so form.htm sends in info to mailprocess.php then to attach.php.
<code>header('Location: error.php');
Be sure you put this before any html or output or you will get a "Header has already been sent error"
</code>