473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

I need some help 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 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 <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 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

Sep 17 '07 #1
3 1931
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 <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 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:

Expand|Select|Wrap|Line Numbers
  1. $message = "Line 1\nLine 2\nLine 3\n$i\n$i++\nthe switch result is:
  2. switch($_POST['abc']) {
  3. case "A":
  4. $message .= "a";
  5. break;
  6. case "B":
  7. $message .= "b";
  8. break;
  9. case "C":
  10. $message .= "c";
  11. break;
  12. default:
  13. $message .= "nothing";
  14. break;
  15. }
  16.  
Sep 17 '07 #2
On Sep 17, 12:06 pm, shror <shahi...@gmail.comwrote:
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 <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 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/...cripts_17.html

Sep 17 '07 #3

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 <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 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

Sep 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
6
by: Kurt A. Kaylor | last post by:
Hey, I am trying to get some code I have written to work. Runs well until I make a request. The I get some problems with PHP related to an SQL statement. Here are the errors :Warning:...
38
by: Red Dragon | last post by:
I am self study C student. I got stuck in the program below on quadratic equation and will be most grateful if someone could help me to unravel the mystery. Why does the computer refuse to execute...
0
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional...
4
by: saverain | last post by:
//WaveIn.h MMRESULT IsFormatSupported(LPWAVEFORMATEX pwfx, UINT uDeviceID) { return waveInOpen ( NULL, // ptr can be NULL for query uDeviceID, // The device identifier...
12
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed...
5
by: simononestop | last post by:
Hi im totally new to perl this is my first go at using it (I normally use asp). I have set up a form with a cgi script from demon hosting. I have edited the script and the form works it sends me an...
1
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
4
by: mattehz | last post by:
Hey there, I am trying to upload old source files and came across these errors: Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.