Topic awaiting preservation: php email form |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: K-town, FL, USA |
posted 06-30-2005 06:23
I am having a tough time trying to figure out why my else if(isset($_post['submit'])) statement is not working. Here is the code. code: <?php $form_info="<form method=\"post\" action=\"$_server[php_self]\"> Please fill out the required fields below then click the submit button.<br /><br /> <table> <tr> <td><strong>Name of Borrower:</strong></td> <td><input type=\"text\" name=\"borrower_name\" value=\"$_post[borrower_name]\" size=30></td> </tr> <tr> <td><strong>Name of Client (Lender):</strong></td> <td><input type=\"text\" name=\"client_name\" value=\"$_post[client_name]\" size=30></td> </tr> <tr> <td><strong>Attention:</strong></td> <td><input type=\"text\" name=\"attention\" value=\"$_post[attention]\" size=30></td> </tr> <tr> <td><strong>Subject Address:</strong></td> <td><input type=\"text\" name=\"subject_address\" value=\"$_post[subject_address]\" size=30></td> </tr> <tr> <td><strong>Legal Description:</strong></td> <td><textarea name=\"legal_description\" cols=30 rows=5 wrap=virtual>$_POST[legal_description] </TEXTAREA></td> </tr> <tr> <td><strong>Access to Property:</strong></td> <td><input type=\"text\" name=\"access_property\" value=\"$_post[access_property]\" size=30></td> </tr> <tr> <td><strong>Owner of Record:</strong></td> <td><input type=\"text\" name=\"owner_record\" value=\"$_post[owner_record]\" size=30></td> </tr> </table> <input type=\"hidden\" name=\"op\" value=\"ds\"> <p><input type=\"submit\" name\"send\" value=\"submit\"></p> </form>"; if(!isset($_post['submit'])) { echo "$form_info"; } else if(isset($_post['submit'])) { if($_post[borrower_name]=="") { $name_err="<font color=red>Please enter your name</font><br />"; $send="no"; } if($_post[legal_description]=="" && $_post[subject_address]=="") { $legal_err ="<font color=red>Must provide legal description or subject address</font><br />"; $send="no"; } if($send !="no") { $to ="seymour.adam@gmail.com"; $subject="Appriasal Order"; $mailheaders="From: Smith-Parke & Co.<>"; $msg="$_post[borrower_name]\n"; mail($to, $subject, $msg, $mailheaders); echo "<p><center><h2>Mail has been sent!</h2></center></p>"; } else if ($send=="no"){ echo "$name_err"; echo "$legal_err"; }} ?>
|
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 06-30-2005 08:40
easy answer. The array is called $_POST. All capitals - variables in PHP are case sensitiv. |
Bipolar (III) Inmate From: K-town, FL, USA |
posted 06-30-2005 19:16
Thanks Tyberius that helped a little but my page still doesnt seem to be working with the submit button. I have changed all the $_post to $_POST but when i added the Error_reporting(E_ALL); i found that all of my variables were undefined. |
Bipolar (III) Inmate From: Minnesota |
posted 06-30-2005 19:22
you named your submit button send. You should use $_POST['send'] |
Maniac (V) Inmate From: under the bed |
posted 06-30-2005 20:03
Or better yet, name your submit button 'submit' |
Bipolar (III) Inmate From: K-town, FL, USA |
posted 06-30-2005 21:10
haha, isnt that some shit im just an idiot |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 07-01-2005 08:47
Yeah. And if you don't want to check on your submit button, you could use empty($_POST). It's set all the time, but if there was no post data, it will be empty. |
Bipolar (III) Inmate From: K-town, FL, USA |
posted 07-01-2005 16:25
I got everything to work. This was my first php attempt and I had a couple of stupid errors that I over looked but over all it turned out quite well. Thanks again for all the help asylumates. |