/    Sign up×
Community /Pin to ProfileBookmark

PHP beginner could use some help here!

Well hell, I won’t know unless i ask! Just stumbled across this place whilst trying to solve a problem with a PHP script so i figured i’d see if anyone can point me in the right direction.

I’m new to this, just finding my way to web design so bear with me if i sound like i ain’t quite with it sometimes…it’s because i’m not!

I’m trying to run a very basis PHP script for a feedback form but cannot seem to get it to work…

The form is at [url]www.hovis21.sendmail.html[/url]
It is run on a windows server

I had tried the following as a script:

[code=php]<?php
$email = $_REQUEST[’email’] ;
$message = $_REQUEST[‘message’] ;

mail( “[email protected]”, “Feedback Form Results”,
$message, “From: $email” );
header( “Location: http://www.hovis21.com/sendmail_thanks.html” );
?>[/code]

The form works but no email is generated. I have since found out from streamline.net who host the site that i need to alter the script to stop potential spam….they told me to:

“Use the PHP mail function and set the mail from using the following line of code.

[code=php]ini_set(“sendmail_from”, ” [email protected] “); [/code]

When i try to replace

[code=php]“From: $email” );[/code]

with this I just get a parsing error…unsurprising since i’m not sure if i’m doing the right thing and i can’t get a more detailed answer from streamline.

Anyway, just wondered if anyone out there could show me where i’m going wrong. I’d like to teach myself PHP scripting but it seems i’ve fallen at the first hurdle!

Cheers
Tom

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@littlenedAug 11.2006 — I always use this code


[CODE]
$subject = "You have new email";
$to = "email to send to";
$toname = "name of who your sending the mail to";
$body = "email message here";

$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$headers .= 'To: '.$to.' '.$toname.' <'.$toname.'>' . "rn";
$headers .= 'From: Whoeveryouare <[email protected]>' . "rn";

mail($to, $subject, $body, $headers);
[/CODE]


hope thats useful, will allow you to put HTML code in the email as well.
Copy linkTweet thisAlerts:
@hovisauthorAug 11.2006 — Ok, i think that makes sense...i'll try it and see. My only issue is i was trying not to alter the code too much, as i've just about understood how it works...the more i change the less i understand.

I wanted to get to grips with the basic form i have and then try to add to it...the problem seems to me to be the part that refers to the sender's email. If i can sort that then i think the rest will work. I'm hopeful anyway!!

Cheers

Tom
×

Success!

Help @hovis 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.1,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...