donnamcmillan Posted January 8, 2007 Share Posted January 8, 2007 I have just uploaded a site and the php was not working properly, I was told that it was syntax error because I wasn't opening my php tags properly, so I changed them all to <?php and it all works fine. Except, for this:<form name="thisForm" method="post" [b]action="<?= $filename.$extension ?>#status-message"[/b] onSubmit="return checkForm()">It is a starting php tag but if I change it to <?php the page no longer displays, and if I leave it as is the form doesn't work.If someone could help me out it would be much appreciated. Quote Link to comment Share on other sites More sharing options...
papaface Posted January 8, 2007 Share Posted January 8, 2007 Can you explain what you are attempting to do please? Quote Link to comment Share on other sites More sharing options...
emehrkay Posted January 8, 2007 Share Posted January 8, 2007 change that to <?php echo $filename.$extensoin; ?> Quote Link to comment Share on other sites More sharing options...
diode Posted January 8, 2007 Share Posted January 8, 2007 Try putting an echo statement before the line, such as:[code]echo '<form name="thisForm" method="post" action="<?= $filename.$extension ?>#status-message" onSubmit="return checkForm()">';[/code] Quote Link to comment Share on other sites More sharing options...
diode Posted January 8, 2007 Share Posted January 8, 2007 Oh yeah, forgot, make sure that line is between the first <?php and the ?> tag, since the line I suggested is php code.Hope it helps, :)diode Quote Link to comment Share on other sites More sharing options...
donnamcmillan Posted January 8, 2007 Author Share Posted January 8, 2007 None of that seems to be working, action="<?= $filename.$extension ?>#status-message"If this is already inside php tags does it need them again here? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted January 8, 2007 Share Posted January 8, 2007 Please post the entire script between [nobbc][code][/code][/nobbc] tags. Without seeing that line in the context of the entire script, we really can't do much more than guess at your problem.Ken Quote Link to comment Share on other sites More sharing options...
donnamcmillan Posted January 8, 2007 Author Share Posted January 8, 2007 Here's the whole code.But the gist of what I'm trying to do is instead of sending the form information to a new page, regenerate the same page.<?php //$cemail='josh_denning@optusnet.com.au';$cemail='donna@simply.com.au';$company='Wealth Power Freedom';function emailCheck($input) { if (is_numeric(strpos($input,'@')) && is_numeric(strpos($input,'.')) && (eregi("(cc:|,)",$input)!= 1) && (eregi("[:;<>]",$input)!=1) && (substr_count($input,'@')==1)) { return '1'; // Input is OK. } else { return '0'; // Input is Bad! }}if ($_POST['action']=='Send Inquiry') { if($_POST['fname']!=''){$fname_status='ok';}else{$ok=0;$fname_status='no';} if($_POST['lname']!=''){$lname_status='ok';}else{$ok=0;$lname_status='no';} if($_POST['email']!=''){$email_status='ok';}else{$ok=0;$email_status='no';} if(emailCheck($_POST['email'])=='1'){$email_status='ok';}else{$ok=0;$email_status='no';} if ($ok=='0') { $status=0; // Email was not sent. echo '<a name="status-message"><p class="status-no" style="color:red"><strong>Your form was NOT sent!</strong> Please check your details and try again.</p>'; } else { $status=1; // Email was sent. // ----- ADMIN AND USER DETAILS ----- $to = $company." <".$cemail.">"; $headers .= "From: info@wealthpowerfreedom.com.au"; $subject = $company.' '.$_POST['formname'].' - '.$_POST['fname'].' '.$_POST['lname']; // ----- ADMIN MESSAGE ----- $adminmsg = $company.",\n\n"; $adminmsg.= "Below are the details provided by ".$_POST['fname']." ".$_POST['lname']."\n\n"; $adminmsg.= "----------------------------------------\n\n"; // ----- USER'S DETAILS ----- $details.="First Name: ".$_POST['fname']."\n\n"; $details.="Last Name: ".$_POST['lname']."\n\n"; $details.="Company Name: ".$_POST['cname']."\n\n"; $details.="Email: ".$_POST['email']."\n\n"; $details.="I am: ".$_POST['iam']."\n\n"; $details.="My question relates to: ".$_POST['relate']."\n\n"; $details.="----------------------------------------\n\nComments/Question:\n\n".$_POST['comments']."\n\n"; // ----- EMAIL FOOTER ----- $details.= "\n----------------------------------------\n"; $details.= "PRIVACY AND CONFIDENTIALITY NOTICE: The contents and information contained in this email is intended for the named recipients only. If you are not an intended recipient, you must not copy, distribute or take any action in reliance on it. If you have received this email in error, please notify us immediately and destroy this email. We hereby disclaim any liability for any loss or damage caused to any party (including the recipient of this email) due to the existence of this email. For security reasons the following details were recorded:\n\n"; $details.= "Sender's IP Details: ".$REMOTE_ADDR." (".gethostbyaddr($REMOTE_ADDR).")\n"; $details.= "Time of send: ".date("g:i:s A")." on ".date("l, jS F Y")." +10:00"; // ----- SEND ----- mail($to,$subject,$adminmsg.$details,$headers); //mail($touser,$subject,$message.$details,$headersuser); mail('donna@simply.com.au',$subject,$adminmsg.$details,$headers); // Backup Send echo '<a name="status-message"><p class="status-ok"><strong>Your form was sent successfully!</strong></p>'; }}?><script language="JavaScript">function checkForm(){tFrm=document.thisForm;valchk=tFrm.fname;if(valchk.value==''){alert("Please enter some details for 'First Name'.");valchk.focus();valchk.select();return false;}valchk=tFrm.lname;if(valchk.value==''){alert("Please enter some details for 'Last Name'.");valchk.focus();valchk.select();return false;}hasDot=tFrm.email.value.indexOf(".");hasAt=tFrm.email.value.indexOf("@");if(hasDot == -1||hasAt == -1){alert("Please enter a valid email address.");tFrm.email.focus();tFrm.email.select();return false;}return true;}</script> <p class="header"><strong>General Inquiries </strong></p> <form name="thisForm" method="post" action="<?=$filename.$extension ?>#status-message" onSubmit="return checkForm()">';?> <input type="hidden" name="formname" value="Contact Form"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td><span class="<?php if(!isset($ok)){$fname_status='ok';}echo $fname_status; ?>"> <label for="fname">First Name<strong><font color="#FF0000">*</font> </strong></label> </span></td> <td><span class="<?php if(!isset($ok)){$fname_status='ok';}echo $fname_status; ?>"><label for="fname"><input type="text" size="30" name="fname" value="<?php if ($status==0) echo $_POST['fname'] ?>"/></label></span></td> </tr> <tr> <td><span class="<?php if(!isset($ok)){$lname_status='ok';}echo $lname_status; ?>"> <label for="lname">Last Name<font color="#FF0000"><strong>*</strong> </font></label> </span></td> <td><span class="<?php if(!isset($ok)){$lname_status='ok';}echo $lname_status; ?>"> <label for="lname"> <input type="text" size="30" name="lname" value="<?php if ($status==0) echo $_POST['lname'] ?>"/> </label> </span></td> </tr> <tr> <td><span class="<?php if(!isset($ok)){$cname_status='ok';}echo $cname_status; ?>"> <label for="cname">Company Name </label> </span></td> <td><input name="cname" type="text" id="cname" size="30"/></td> </tr> <tr> <td><span class="<?php if(!isset($ok)){$email_status='ok';}echo $email_status; ?>"> <label for="email">Email<font color="#FF0000"><strong>*</strong> </font></label> </span></td> <td><span class="<?php if(!isset($ok)){$email_status='ok';}echo $email_status; ?>"><label for="email"><input type="text" size="30" name="email" value="<?php if ($status==0) echo $_POST['email'] ?>"/></label></span></td> </tr> <tr> <td>I am</td> <td> <select name="iam"> <option value="" selected>Please select option</option> <option value="a Member">a Member</option> <option value="an Affiliate">an Afilliate</option> <option value="Interested">Interested</option> <option value="Potential JV">Potential JV</option> <option value="General">General</option> </select> </td> </tr> <tr> <td>My question relates to</td> <td> <select name="relate"> <option value="" selected>Please select option</option> <option value="Help">Help</option> <option value="Marketing">Marketing</option> <option value="JV">JV</option> <option value="General">General</option> </select> </span></td> </tr> <tr> <td valign="top">Comments/Question</td> <td><textarea name="comments" cols="40" rows="5" id="comments"></textarea></td> </tr> <tr> <td colspan="2" align="right"><input name="action" type="submit" id="Submit" value="Send Inquiry" /></td> </tr> </table> </form> <p><strong>Sydney, Australia Office</strong></p> <p>Australia<br />Phone: 02 8819 6696<br />Mobile: 0420 388 584<br />Email: <a href="mailto:admin@wealthpowerfreedom.com">admin@wealthpowerfreedom.com</a></p> <p>International<br />Phone: +61-2-8819-6696<br />Mobile: +61-420-388-582<br />Email: <a href="mailto:admin@wealthpowerfreedom.com">admin@wealthpowerfreedom.com</a></p> <br /> Quote Link to comment Share on other sites More sharing options...
diode Posted January 8, 2007 Share Posted January 8, 2007 I would suggest simplifying your value checking ($_POST etc) by putting $thisisavariablename=$_POST['thisisavariablename']; right after the "$company='Wealth Power Freedom';" line. This assigns the value of whatever was in the form field to $thisisavariablename obviously, but it makes it easier to do conditional checking on it later on. Do this for any form field that you want to send back to this page. Oh, and make sure that the form "action" page is the same filename as the one that you got your code from if you want it to work.Hope this helps, :)diode Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 8, 2007 Share Posted January 8, 2007 Change it to<form name="thisForm" method="post" action="<?php echo $filename.$extension; ?>#status-message" onSubmit="return checkForm()">ORturn on short tags Quote Link to comment Share on other sites More sharing options...
donnamcmillan Posted January 9, 2007 Author Share Posted January 9, 2007 I didn't notice there was an error message at the bottom of the screen when I sent the form.[b]PHP Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in D:\hosting\member\joshdenning\site1\contact-us.php on line 89 [/b] On line 89 I have this:[b]mail($to,$subject,$adminmsg.$details,$headers);[/b]Which is refering to:// ----- ADMIN AND USER DETAILS ----- $to = $company." <".$cemail.">"; $headers .= "From: info@wealthpowerfreedom.com.au"; $subject = $company.' '.$_POST['formname'].' - '.$_POST['fname'].' '.$_POST['lname']; // ----- ADMIN MESSAGE ----- $adminmsg = $company.",\n\n"; $adminmsg.= "Below are the details provided by ".$_POST['fname']." ".$_POST['lname']."\n\n"; $adminmsg.= "----------------------------------------\n\n"; // ----- USER'S DETAILS ----- $details.="First Name: ".$_POST['fname']."\n\n"; $details.="Last Name: ".$_POST['lname']."\n\n"; $details.="Company Name: ".$_POST['cname']."\n\n"; $details.="Email: ".$_POST['email']."\n\n"; $details.="I am: ".$_POST['iam']."\n\n"; $details.="My question relates to: ".$_POST['relate']."\n\n"; $details.="----------------------------------------\n\nComments/Question:\n\n".$_POST['comments']."\n\n";I can't see a problem. We have other sites online that use the same code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.