PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > I need some please with mail() & else if problems
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
I need some please with mail() & else if problems

Réponse
 
LinkBack Outils de la discussion
Vieux 17/09/2007, 08h06   #1
shror
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut I need some please with mail() & else if problems

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

  Réponse avec citation
Vieux 17/09/2007, 08h45   #2
Sanders Kaufman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: I need some please with mail() & else if problems

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;
}
  Réponse avec citation
Vieux 17/09/2007, 09h48   #3
Satya
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: I need some please with mail() & else if problems

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

  Réponse avec citation
Vieux 18/09/2007, 00h09   #4
william.clarke
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: I need some please with mail() & else if problems


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

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h52.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16180 seconds with 12 queries