prolinu Posted September 8, 2009 Share Posted September 8, 2009 I am getting this error: Warning: fopen() expects at least 2 parameters, 1 given in /home/... Here is the Code: <? session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> <?php $msg=''; $count_error=0; $to='[email protected]'; echo $to; function valid_email ( $address ) { if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $address)) return false; else return true; } if(isset($_POST['career'])){ if(empty($_POST['name']) || !eregi('^[A-Za-z.]+$', $_POST['name'])) {$msg=$msg."<font color='#ff0000'>Name Is Invalid</font><br>"; $count_error++;} if(empty($_POST['phone']) || !eregi('^[0-9]+$', $_POST['phone'])) {$msg=$msg."<font color='#ff0000'>Mobile Number Must Be Numeric</font><br>"; $count_error++;} if(empty($_POST['email']) ||!valid_email($_POST['email'])) {$msg=$msg."<font color='#ff0000'>Enter Valid Email</font><br>"; $count_error++;} if($count_error == 0) { $message =' <table cellspacing="1" cellpadding="8" border="0" width="400" bgcolor="#FFFFFF"> <tr> <td colspan="2"></td> </tr> <tr bgcolor="#eeeeee"> <td width="119" style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Name</strong></td> <td width="249" style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$_POST['name'].'</td> </tr> <tr><td colspan="2" style="padding:0px;"><img src="images/whitespace.gif" alt="" width="100%" height="1" /></td></tr> <tr bgcolor="#eeeeee"></td> </tr> </table>'; $subject = "Enquiry for Pure Produkts : ".$_POST['apply']; $file = chunk_split(base64_encode($file)); $num = md5(time()); $strname = $_POST['name']; $stremail = $_POST['email']; $headers = "From: $strname<$stremail>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed; "; $headers .= "boundary=".$num."\r\n"; $headers .= "--$num\r\n"; $headers .= "BCC: [email protected]\r\n"; $headers .= "Return-Path: [email protected]\r\n"; $headers .= "Message-ID: <".$num." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n"; $headers .= "X-Mailer: PHP v".phpversion()."\r\n"; $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 8bit\r\n"; $headers .= "".$message."\n"; $headers .= "--".$num."\n"; $headers .= "Content-Type:".$strresume_type." "; $headers .= "name=\"".$strresume_name."\"r\n"; $headers .= "--".$num."--"; if(@mail($to, $subject, $message, $headers)) echo 'Mail Sent....'; fopen($fp); } else { $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $prodchosen = $_POST['prodchosen']; $qty = $_POST['qty']; $unitprice = $_POST['unitprice']; $extprice = $_POST['extprice']; $subtotal = $_POST['subtotal']; $salestax = $_POST['salestax']; $grandtotal = $_POST['grandtotal']; if(!IsSet($_POST['email'])) { $Subscribe=""; } else { $Subscribe=$_POST['email']; } } } ?> Can you help me Link to comment https://forums.phpfreaks.com/topic/173517-warning-fopen-expects-at-least-2-parameters/ Share on other sites More sharing options...
micmania1 Posted September 8, 2009 Share Posted September 8, 2009 http://uk.php.net/function.fopen fopen($file, $mode); $mode is like read-only, write, etc... Check out the link. Link to comment https://forums.phpfreaks.com/topic/173517-warning-fopen-expects-at-least-2-parameters/#findComment-914653 Share on other sites More sharing options...
prolinu Posted September 8, 2009 Author Share Posted September 8, 2009 I can see this: fopen($fp); } else { === What I need to use there ? Link to comment https://forums.phpfreaks.com/topic/173517-warning-fopen-expects-at-least-2-parameters/#findComment-914656 Share on other sites More sharing options...
PFMaBiSmAd Posted September 8, 2009 Share Posted September 8, 2009 You code does not even use any file functions. Why is there an fopen() in it at all? Link to comment https://forums.phpfreaks.com/topic/173517-warning-fopen-expects-at-least-2-parameters/#findComment-914659 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.