/    Sign up×
Community /Pin to ProfileBookmark

Newbie here needs a little help

Howdy~
I was wondering I have the following code and php but the code does not let me put a space in the city (like Johnson Creek) and wondering why the php is not emailing me? Both worked before and all of a sudden they stopped working.

[code]
<form action=”http://mydomain.info/mailer.php” onsubmit=”return require (this)”>
<fieldset> <legend><font color=”#FFFFFF”><b> Submit Message Here To The
Troops </b></font></legend><b><font color=”#FFFFFF”><label>First Name
<input name=”name” type=”text” onchange=”if (!/^[a-z]*$/i.test(this.value)) {alert(); this.value = ”; this.focus()}”>
</label><label>City
<input name=”city” type=”text” onchange=”if (!/^[a-z]*$/i.test(this.value)) {alert(); this.value = ”; this.focus()}”>
</label> <label>State
<input name=”state” type=”text” onchange=”if (!/^[a-z]*$/i.test(this.value)) {alert(); this.value = ”; this.focus()}”>
</label> <label>Message
<textarea name=”message” rows=”10″ cols=”30″></textarea>
</label> <button type=”submit”>Submit</button> </font></b></fieldset>
</form>
[/code]

[code=php]
<?PHP
$to = “[email protected]”; #set address to send form to
$subject = “Subject”; #set the subject line
$forward = 0; # redirect? 1 : yes || 0 : no
$location = “”; #set page to redirect to, if 1 is above

$date = date (“l, F jS, Y”);
$time = date (“h:i A”);

$msg = “Below is a message of test. It was submitted on $date at $time.nn”;

if ($_SERVER[‘REQUEST_METHOD’] == “POST”) {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) .” : “. $value . “n”;
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) .” : “. $value . “n”;
}
}
mail($to, $subject, $msg);
if ($forward == 1) {
header (“Location:$location”);
}
else {
echo “Test<br>test!”;
echo'<br><a href=”/somepage”>Test</a>’;
}
?>
[/code]

Thanks
The Devil

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Tasmanian_Devil spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...