You are here: Re: I need some help please with mail() & else if problems « PHP Programming Language « IT news, forums, messages
Re: I need some help please with mail() & else if problems

Posted by Sanders Kaufman on 09/17/07 07:45

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
>
> <form name="abcform" action="123.php">
> <input type="text" name="abc" size="40" value="choose between these:
> a, b, c">
> <input type="submit" name="submit" value="submit">
> </form>
>
>
> the 123.php code is:
> http://www.beachtoursegypt.com/123.php
>
> <body>
> <?php
> $i=1;
> while($i<=5)
> {
> echo "The number is " . $i . "<br />";
> $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 <shror@shror.com>";
>
> // Send
> mail('me@isp', 'My Subject', $message, $from);
>
> ?>
> </body>
>
>
> 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]

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация