how can I change the echo to a email

the mail() function

Moderators: macek, egami, gesf

pearsam
New php-forum User
New php-forum User
Posts: 15
Joined: Thu Apr 05, 2012 6:51 pm

how can I change the echo to a email

Postby pearsam » Sat Apr 28, 2012 9:03 am

<?php
$name = $_POST["name"];
$address = $_POST["address"];
$city = $_POST["city"];
$state = $_POST["state"];
$zip = $_POST["zip"];
$phone = $_POST["phone"];
$email = $_POST["email"];
$education = $_POST["education"];
$skills = $_POST["skills"];
$accomplishment = $_POST["accomplishment"];
$TofD = $_POST["TofD"];
if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form
?>
<html>
<head>
<title>Job Posting</title>
</head>
<body>
<h1>
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF;?>">
Name:<input type="text" size="30" maxlength="36" name="name"><br />
Street:<input type="text" size="40" maxlength="46" name="address"><br />
City:<input type="text" size="20" maxlength="36" name="city"><br />
State:<input type="text" size="12" maxlength="36" name="state"><br />
Zip code:<input type="text" size="5" maxlength="10" name="zip"><br />
Phone number:<input type="text" size="12" maxlength="36" name="phone"><br />
Email:<input type="text" size="40" maxlength="46" name="email"><br /><br />
Select a Level of Education:<br />
<select name="education">
<option value="Jr.High">Jr.High</option>
<option value="HighSchool">HighSchool</option>
<option value="College">College</option>
<option value="Graduate">Masters</option></select><br /><br />
Typing:<input type="checkbox" value="Typing" name="skills"><br />
Computer:<input type="checkbox" value="Computer" name="skills"><br />
Accounting:<input type="checkbox" value="Accounting" name="skills"><br />
Microsoft Office:<input type="checkbox" value="Office" name="skills"><br /><br />

Accomplishments:<textarea rows="1" cols="60" name="accomplishment" wrap="physical">Enter your Accomplishments here!</textarea><br /><br />

What time of day may we call:<br />
<select name="TofD" size="3">
<option value="Morning">Morning</option>
<option value="Day">Day</option>
<option value="Night">Night</option></select><br />
<input type="submit" value="submit" name="submit">
</form>
<?
} else {
echo "Hello, ".$name." <br />";
echo "You live at ".$address.", ".$city.", ".$state." ".$zip." <br />";
echo "Your Phone# is ".$phone.", and your Email is ".$email.", <br />";
echo "You passed ".$education."! <br />";
foreach ($skills as $s) {
echo $s."<br />";
}
echo "<i>".$accomplishment."</i><br />";
echo "The best time to call is ".$TofD."<br />";
}

?>
Last edited by pearsam on Sat Apr 28, 2012 2:59 pm, edited 1 time in total.

User avatar
minimihi
New php-forum User
New php-forum User
Posts: 238
Joined: Sat Apr 14, 2012 11:57 am
Location: Vilnius, Lithuania

Re: Invalid argument supplied for foreach

Postby minimihi » Sat Apr 28, 2012 1:08 pm

Code: Select all

...<input ... name="skills">

Code: Select all

$skill = $_POST["skill"]; 

Code: Select all

foreach ($skills as $s) { 


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 2 guests