I need some help please with mail() & else if problems

I need some help please with mail() & else if problems

am 17.09.2007 09:06:43 von shror

I was testing to post a form and echo message according to the
submitted box using else if and then mail() the box result to myself
just for testing the procedure but i got some problems:
1# the text box value is not echoed to my result page
2# also the mail doesn't send me the text box value
3# the address bar view that the value entered was the correct value i
entered

so please help me
the 111.htm form code is:
http://www.beachtoursegypt.com/111.htm







the 123.php code is:
http://www.beachtoursegypt.com/123.php


$i=1;
while($i<=5)
{
echo "The number is " . $i . "
";
$i++;
}

$x = $_POST['abc'];
if ($x == "a")
echo "A";
else if ($x == "b")
echo "B";
else if ($x == "c")
echo "C";
else
echo "nothing";

// The message
$message = "Line 1\nLine 2\nLine 3\n$i\n$i++\nthe switch result is:
$x";

// In case any of our lines are larger than 70 characters, we should
use wordwrap()
$message = wordwrap($message, 70);
$from = "From: shror ";

// Send
mail('me@isp', 'My Subject', $message, $from);

?>



the mail result I get is:

Line 1
Line 2
Line 3
6
6++
the switch result is:



could anybody help me please and also I want to know how to use switch
case because i tried to use them also but failed, so if any body have
a working example for switch case with mail() this will really be
great and appreciated.

shror

Re: I need some help please with mail() & else if problems

am 17.09.2007 09:45:41 von Bucky Kaufman

shror wrote:
> I was testing to post a form and echo message according to the
> submitted box using else if and then mail() the box result to myself
> just for testing the procedure but i got some problems:
> 1# the text box value is not echoed to my result page
> 2# also the mail doesn't send me the text box value
> 3# the address bar view that the value entered was the correct value i
> entered
>
> so please help me
> the 111.htm form code is:
> http://www.beachtoursegypt.com/111.htm
>
>


>
>
>

>
>
> the 123.php code is:
> http://www.beachtoursegypt.com/123.php
>
>
> > $i=1;
> while($i<=5)
> {
> echo "The number is " . $i . "
";
> $i++;
> }
>
> $x = $_POST['abc'];
> if ($x == "a")
> echo "A";
> else if ($x == "b")
> echo "B";
> else if ($x == "c")
> echo "C";
> else
> echo "nothing";
>
> // The message
> $message = "Line 1\nLine 2\nLine 3\n$i\n$i++\nthe switch result is:
> $x";
>
> // In case any of our lines are larger than 70 characters, we should
> use wordwrap()
> $message = wordwrap($message, 70);
> $from = "From: shror ";
>
> // Send
> mail('me@isp', 'My Subject', $message, $from);
>
> ?>
>
>
>
> the mail result I get is:
>
> Line 1
> Line 2
> Line 3
> 6
> 6++
> the switch result is:
>
>
>
> could anybody help me please and also I want to know how to use switch
> case because i tried to use them also but failed, so if any body have
> a working example for switch case with mail() this will really be
> great and appreciated.

I have no idea what most of the rest of that code is intended to do.
But this should solve the switch part of your question:

[code]
$message = "Line 1\nLine 2\nLine 3\n$i\n$i++\nthe switch result is:
switch($_POST['abc']) {
case "A":
$message .= "a";
break;
case "B":
$message .= "b";
break;
case "C":
$message .= "c";
break;
default:
$message .= "nothing";
break;
}
[/code]

Re: I need some help please with mail() & else if problems

am 17.09.2007 10:48:52 von satya

On Sep 17, 12:06 pm, shror wrote:
> I was testing to post a form and echo message according to the
> submitted box using else if and then mail() the box result to myself
> just for testing the procedure but i got some problems:
> 1# the text box value is not echoed to my result page
> 2# also the mail doesn't send me the text box value
> 3# the address bar view that the value entered was the correct value i
> entered
>
> so please help me
> the 111.htm form code is:http://www.beachtoursegypt.com/111.htm
>
>


>
>
>

>
> the 123.php code is:http://www.beachtoursegypt.com/123.php
>
>
> > $i=1;
> while($i<=5)
> {
> echo "The number is " . $i . "
";
> $i++;
> }
>
> $x = $_POST['abc'];
> if ($x == "a")
> echo "A";
> else if ($x == "b")
> echo "B";
> else if ($x == "c")
> echo "C";
> else
> echo "nothing";
>
> // The message
> $message = "Line 1\nLine 2\nLine 3\n$i\n$i++\nthe switch result is:
> $x";
>
> // In case any of our lines are larger than 70 characters, we should
> use wordwrap()
> $message = wordwrap($message, 70);
> $from = "From: shror ";
>
> // Send
> mail('me@isp', 'My Subject', $message, $from);
>
> ?>
>
>
> the mail result I get is:
>
> Line 1
> Line 2
> Line 3
> 6
> 6++
> the switch result is:
>
> could anybody help me please and also I want to know how to use switch
> case because i tried to use them also but failed, so if any body have
> a working example for switch case with mail() this will really be
> great and appreciated.
>
> shror

I will only say use phpmailer package.
check here: http://satya61229.blogspot.com/2007/03/php-mail-scripts_17.h tml

Re: I need some help please with mail() & else if problems

am 18.09.2007 01:09:50 von william.clarke

shror wrote:
> I was testing to post a form and echo message according to the
> submitted box using else if and then mail() the box result to myself
> just for testing the procedure but i got some problems:
> 1# the text box value is not echoed to my result page
> 2# also the mail doesn't send me the text box value
> 3# the address bar view that the value entered was the correct value i
> entered
>
> so please help me
> the 111.htm form code is:
> http://www.beachtoursegypt.com/111.htm
>
>


>
>
>

>
>
> the 123.php code is:
> http://www.beachtoursegypt.com/123.php
>
>
> > $i=1;
> while($i<=5)
> {
> echo "The number is " . $i . "
";
> $i++;
> }
>
> $x = $_POST['abc'];
> if ($x == "a")
> echo "A";
> else if ($x == "b")
> echo "B";
> else if ($x == "c")
> echo "C";
> else
> echo "nothing";
>
> // The message
> $message = "Line 1\nLine 2\nLine 3\n$i\n$i++\nthe switch result is:
> $x";
>
> // In case any of our lines are larger than 70 characters, we should
> use wordwrap()
> $message = wordwrap($message, 70);
> $from = "From: shror ";
>
> // Send
> mail('me@isp', 'My Subject', $message, $from);
>
> ?>
>
>
>
> the mail result I get is:
>
> Line 1
> Line 2
> Line 3
> 6
> 6++
> the switch result is:
>
>
>
> could anybody help me please and also I want to know how to use switch
> case because i tried to use them also but failed, so if any body have
> a working example for switch case with mail() this will really be
> great and appreciated.
>
> shror

For general language constructs like switch the best place to look is
the PHP manuals (which are available for free online ).

http://au3.php.net/switch