Page 1 of 1
Simple Email Form
Posted: Mon Jul 24, 2006 5:12 pm
by nickman013
Hello,
I cant seem to spot the error of this. I have a form in a iFrame, and it proccesses the form in the iFrame on another page.
The form code is,
Code: Select all
<center>
<font size=3 color=blue>If you have a muot that you want us to research on, enter its name here.</font><br>
<form action=/quicklist/process.php method=post>
<input type=text maxlenth=40 name=name>
<input type="button" Value="Submit!" onclick="check(form,form.elements.length)">
<input type="hidden" name="r_name" value="You did not enter the muots name.">
</form>
</center>
The reason the submit button is a button, is because I have a code that checks and makes sure everything is entered in the form.
The process.php is this
Code: Select all
<?php
mail("nickman013@mac.com","MUOT QUICKLIST",$name);
?>
<font color=white><center><font size=5><b>
Thank You</b></font></center>
I dont get a syntax error. It says Thank You. I get a email, but it doesnt have the $name value.
Any help would be great, thanks!
Posted: Mon Jul 24, 2006 5:32 pm
by Benjamin
Try this..
It is not secure by the way..
Code: Select all
mail("nickman013@mac.com","MUOT QUICKLIST",$_POST['name']);
Posted: Mon Jul 24, 2006 5:38 pm
by nickman013
Thank You.
Register Globals is on. But thanks alot!
Posted: Mon Jul 24, 2006 5:43 pm
by nickman013
Now I am trying to do this.
Code: Select all
<?
$_POST['name'] == $name;
function generateEmail($name)
{
return "
Someone wants us to hunt down and write a report on a muot that goes by the name <font size=3 color=red><b> $name </b></font>
";
}
mail("nickman013@mac.com","MUOT SUBMITION",generateEmail($name), "Content-type: text/html\r\n");
?>
<font color=white><center><font size=5><b>
Thank You</b></font></center>
But it doesnt work. Thanks for all of your help.
PS. Sorry for double posting.
Posted: Mon Jul 24, 2006 6:01 pm
by Benjamin
nickman013 wrote:Now I am trying to do this.
I wouldn't use short tags. And I'm not sure why you have that line above as it's not doing anything for you. == is a comparison operator, not an assignment operator.
I know this function works..
Code: Select all
function send_mail($from, $to, $subject, $body) {
$header = "From: " . $from . "\n";
mail($to, $subject, $body, $header);
}
Posted: Mon Jul 24, 2006 8:55 pm
by nickman013
Ok this is my process script, I dont even get an email.
Code: Select all
<?
$from = "MUOT.NET";
$to = "nickman013@mac.com";
$subject = "MUOT QUICKLIST";
$body = "Someone wants us to hunt down and write a report on a muot that goes by the name <font size=3 color=red><b> $name </b></font>";
function send_mail($from, $to, $subject, $body) {
$header = "From: " . $from . "\n";
mail($to, $subject, $body, $header);
}
?>
<font color=white>
<center><font size=5><b>
Thank You
</b>
</font>
</center>
I dont get a parse error either.
Any help would be great !
Posted: Mon Jul 24, 2006 9:03 pm
by Benjamin
The function is not being called...
Code: Select all
<?php
$from = "MUOT.NET";
$to = "nickman013@mac.com";
$subject = "MUOT QUICKLIST";
$body = "Someone wants us to hunt down and write a report on a muot that goes by the name <font size=3 color=red><b> $name </b></font>";
function send_mail($from, $to, $subject, $body) {
$header = "From: " . $from . "\n";
mail($to, $subject, $body, $header);
}
if ((isset($_POST['name'])) && ($_POST['name'] != '')) {
send_mail($from, $to, $subject, $body);
}
?>
Posted: Mon Jul 24, 2006 9:15 pm
by nickman013
My code now,
Code: Select all
<?php
$from = "MUOT.NET";
$to = "nickman013@mac.com";
$subject = "MUOT QUICKLIST";
$body = "Someone wants us to hunt down and write a report on a muot that goes by the name <font size=3 color=red><b> $name </b></font>";
function send_mail($from, $to, $subject, $body) {
$header = "From: " . $from . "\n";
mail($to, $subject, $body, $header);
}
if ((isset($_POST['name'])) && ($_POST['name'] != '')) {
send_mail($from, $to, $subject, $body);
}
?>
<font color=white>
<center><font size=5><b>
Thank You
</b>
</font>
</center>
The email I receive
Someone wants us to hunt down and write a report on a muot that goes by the name <font size=3 color=red><b> </b></font>
I made sure that the form input name was correct, and it was.
I appreciate all your help!
Posted: Mon Jul 24, 2006 9:19 pm
by Benjamin
You should be using quotes around the attributes, maybe that is causing the problem...
Code: Select all
<center>
<font size=3 color=blue>If you have a muot that you want us to research on, enter its name here.</font><br>
<form action="/quicklist/process.php" method="post">
<input type="text" maxlenth="40" name="name">
<input type="button" Value="Submit!" onclick="check(form,form.elements.length)">
<input type="hidden" name="r_name" value="You did not enter the muots name.">
</form>
</center>
If that doesn't fix it, on the page with the mail function, paste the results of this..
Code: Select all
echo '<pre>';
print_r($_POST);
echo '</pre>';
Posted: Mon Jul 24, 2006 9:27 pm
by nickman013
The fixed the attributes, and it didnt work.
The results were
Array
(
[name] => ok
[r_name] => You did not enter the muots name.
)
Posted: Mon Jul 24, 2006 9:32 pm
by Benjamin
Well that doesn't make any sense then. If this doesn't fix it I'm not sure I can help you. I'm not sure your statement about Globals being turned on is correct.
Code: Select all
$body = "Someone wants us to hunt down and write a report on a muot that goes by the name <font size=3 color=red><b> " . $_POST['name'] . " </b></font>";
Posted: Mon Jul 24, 2006 9:36 pm
by feyd
astions wrote:I'm not sure your statement about Globals being turned on is correct.
Let's find out!
nickman013,
Run the following in a new file and tell us the results please.
Code: Select all
<?php
$neg = array(0, false, '', null, 'off');
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
$rg = (in_array(strtolower(ini_get('register_globals')), $neg) ? 'Off' : 'On');
$de = (in_array(strtolower(ini_get('display_errors')), $neg) ? 'Off' : 'On');
$so = (in_array(strtolower(ini_get('short_open_tag')), $neg) ? 'Off' : 'On');
$le = '';
$cli = (php_sapi_name() == 'cli');
$eol = ($cli ? "\n" : "<br />\n");
$gle = get_loaded_extensions();
$rows = array();
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
$le .= ' ' . implode(' ', array_slice($gle, $i, $wide)) . "\n";
}
if ($cli)
{
$le = $eol . $le;
}
else
{
$le = '<pre>' . $le . '</pre>';
}
$ec = array(
'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);
$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
if (($t & $v) == $v)
{
$e[] = $n;
$t ^= $v;
}
}
$er = $er . ' (' . implode(' | ', $e) . ')';
if (!$cli)
{
echo '<html><head><title>quick info</title></head><body>' . "\n";
}
echo 'PHP Version: ' . $ve . $eol;
echo 'PHP OS: ' . $os . $eol;
echo 'Error Reporting: ' . $er . $eol;
echo 'Register Globals: ' . $rg . $eol;
echo 'Short Tags: ' . $so . $eol;
echo 'Display Errors: ' . $de . $eol;
echo 'Loaded Extensions:' . $le . $eol;
if (!$cli)
{
echo '</body></html>' . "\n";
}
?>
Posted: Mon Jul 24, 2006 9:38 pm
by nickman013
It was my mistake. Register globals was not turned on in the folder that the process.php was in.
Thank you. I have one for question, how can I get the email to accept HTML.
THANKS SO MUCH!

Posted: Mon Jul 24, 2006 9:57 pm
by Benjamin
I believe the easiest way to send HTML emails would be to use d11wtq's swiftmailer..
viewtopic.php?t=48055
Posted: Mon Jul 24, 2006 10:00 pm
by nickman013
Thank you.