FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

form submission prob

 


riyadh
i made a a php page where i also wrote the code for submitting the form. but it doesn't work. the code is given below.
Code:

<?php
if(isset($_POST['upload'])) {
$mail = "someone@example.net";
$location = "thanku.php";
$sub = $_POST['sub'];
$name = $_POST['name'];
$email = $_POST['email'];
$request = $_POST['request'];
$ip = $_SERVER['REMOTE_ADDR'];
$mail_header .= "X-Sender-IP: $ip";
$mail_header .= "Content-Type: text/plain";

$mess =
"Request \n\n" .
"\n Name: $name \n" .
"\n Email: $email \n" .
"\n Request: $company \n";

mail($mail,$sub,$mail_header,$mess,"From: $name <$email>\n");
header ("Location: $location");
}
else {
?><form action="" action="POST">
Subject: <input type="text" size="40" autocomplete="OFF" style="height: 20px;" class="input" name="sub" /><br /><br />
Name: <input type="text" size="40" autocomplete="OFF" style="height: 20px;" class="input" name="name" /><br /><br />
Email Address: <input type="text" size="36" autocomplete="OFF" style="height: 20px;" class="input" name="email" /><br /><br />
Request: <textarea name="request" rows="5" columns="40"></textarea><br /><br />
<input type="submit" name="submit" class="button" value="Submit" style="height: 20px;" onClick="return checkmail(this.form.email)" />&nbsp;<input type="reset" class="button" value="Reset"></form>
<?php
} //end if
?>
sonam
Is it come blank page or you get some error message?

Put this two lines on top of your PHP script and see what happend:

Code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

....
?>
sonam
in your first line you have

Code:
if(isset($_POST['upload'])) {


and your submit button have different name:

Code:
<input type="submit" name="submit" class="button" value="Submit"


Sonam
riyadh
i corrected the mistake but there is still an error:
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 11520 bytes) in /home/riyadh/domains/dreamer.frih.net/public_html/index.php on line 114
Alias
Maybe I could help... What are the codes that are in line 113-115?
riyadh
this is code between line 113-115 in index.php:
Code:

<!-- start footer -->
<table align=center cellpadding=0 cellspacing=0 style="background-color: white; width: 725px;"><tr><td></td></tr><tr><td></td></tr>
<tr><td align=center>
<table align=center cellpadding=0 cellspacing=0 style="background-color: #000000; width: 725px;"><tr>
<td align=left style="padding: 5px 0px 5px 5px;"><font class="font3"><SCRIPT>document.write("Page Loaded In: " +loadtime+ " seconds");</SCRIPT></font></td><td align=right style="padding: 5px 5px 5px 5px;"><font class="font3">&copy; 2006 Riyadh Al Nur</font></td></tr></table>
</td></tr></table>
<!-- end footer -->
sb3700
Not sure what your problem is exactly, but try specifying your action of the form, ie: change:
Code:
<form action="" action="POST">

to:
Code:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" action="POST">
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.