|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 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 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 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 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 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;
}
|
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Sep 17, 12:06 pm, shror <shahi...@gmail.com> 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 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 <sh...@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 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/...cripts_17.html |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 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 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 |
|
![]() |
| Outils de la discussion | |
|
|