Closed Thread Icon

Topic awaiting preservation: php email form Pages that link to <a href="https://ozoneasylum.com/backlink?for=26126" title="Pages that link to Topic awaiting preservation: php email form" rel="nofollow" >Topic awaiting preservation: php email form\

 
Author Thread
Seymour
Bipolar (III) Inmate

From: K-town, FL, USA
Insane since: Jun 2002

posted 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";
}}
?>



Here is what I get form the code on the site
http://www.seymoursworld.com/smithparke/email_order.php

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-30-2005 08:40

easy answer. The array is called $_POST. All capitals - variables in PHP are case sensitiv.

You might wish to add Error_reporting(E_ALL); to the beginning of your file to be warned about undefined variables.

so long,

->Tyberius Prime

Seymour
Bipolar (III) Inmate

From: K-town, FL, USA
Insane since: Jun 2002

posted 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.

Here is what is gave me.

Nathus
Bipolar (III) Inmate

From: Minnesota
Insane since: Aug 2003

posted posted 06-30-2005 19:22

you named your submit button send. You should use $_POST['send']

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 06-30-2005 20:03

Or better yet, name your submit button 'submit'

Seymour
Bipolar (III) Inmate

From: K-town, FL, USA
Insane since: Jun 2002

posted posted 06-30-2005 21:10

haha, isnt that some shit im just an idiot


Thank you guys.. your real life savers.. and I'm not talking about round fruity kind!

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted 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.

Seymour
Bipolar (III) Inmate

From: K-town, FL, USA
Insane since: Jun 2002

posted 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.

« BackwardsOnwards »

Show Forum Drop Down Menu