/    Sign up×
Community /Pin to ProfileBookmark

Need Help: Form Submit via Email! Please!!!

I’ve gotten alot of help on this project thus far; so thank you all.

My final issue is getting the “order confirmation” page to convert to an email when the client hits “submit”.

I currently have the page set up with a PHP script I was told to place in the page, but it does not work. To save space, below is the page:

[url]http://www.miscomputer.com/consorta/desktop/[/url]
This page is where the client builds their desktop computer.

[url]http://www.miscomputer.com/consorta/desktop/confirm.php[/url]
This page confirms the build from the previous page along with ship to instructions, contact info, etc. At the bottom is a submitt button. I want this to then email to me the confirmation build and the information they fill out in bottom. I was told by someone this would have to be a PHP. I also inserted PHP script he passed along to me but it doesn’t seem to work. (I’ve since placed it inside the HTML portion of the doc)

Any help would be greatly appreciated.

to post a comment
PHP

13 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsNov 19.2005 — The problem is that the .html file isn't being parsed as PHP.
Copy linkTweet thisAlerts:
@SheldonNov 19.2005 — Either rename you file and links to .php or create/edit your .htaccess file to allow html to be parsed as php.

Add this line to the .htaccess file.
[code=php]AddType text/html .html
AddHandler server-parsed .php[/code]
Copy linkTweet thisAlerts:
@PharmerGuyauthorNov 21.2005 — Either rename you file and links to .php or create/edit your .htaccess file to allow html to be parsed as php.

Add this line to the .htaccess file.
[code=php]AddType text/html .html
AddHandler server-parsed .php[/code]
[/QUOTE]


I'm sorry, I don't know what the htaccess file is (what do you mean by this?). Also, how do I save this as a PHP file in Front Page? Should I save the code instead in Dreamweaver?
Copy linkTweet thisAlerts:
@bokehNov 21.2005 — Front Page... Dreamweaver?[/QUOTE]Is he allowed to mention both of those in one single post?

.htaccess (notice the dot) is an optional file usually located in the root directory but that can be located in sub-directorys that allows you to set certain server configuration options. It is available only for users of Apache servers and only when its use has been enabled in httpd.conf (the main server configuration file).
Copy linkTweet thisAlerts:
@PharmerGuyauthorNov 21.2005 — Hah! So I'm back to square one. I just want the confirmation screen to email to me once they click submitt. I was told to go via PHP. How do I do this? I'm on a deadline and would apprecaite ANYTHING ANYONE can do.

I also know very little PHP (as if you couldn't guess) and received this script from someone else here. But I can't get it to work. Like I said - I just want the confirmation screen (with the build of the computer from the previous screen 'desktop.html' to email to me once they hit submit).

Hopefully this is enough info. I pasted the page addresses above so you can see my current script.
Copy linkTweet thisAlerts:
@yngexecNov 21.2005 — you need something like this?

if (isset($_POST['wheretopost']) && ('process' == $_POST['wheretopost'])) {
process_form();
} else {
print_form();
}
Copy linkTweet thisAlerts:
@SheldonNov 21.2005 — You need to set up and use sessions rather than javascript to pass what the user has brought, Then When the end user submits the confirmation the will pull the info from the sessions and send it.

[url=http://php.net/sessions]PHP SESSIONS[/url]

[url=http://php.net/mail]PHP MAIL[/url]



Front Page... Dreamweaver?[/quote]
Is he allowed to mention both of those in one single post? [/quote]

Both are evil, evil, evil!
Copy linkTweet thisAlerts:
@PharmerGuyauthorNov 21.2005 — You need to set up and use sessions rather than javascript to pass what the user has brought, Then When the end user submits the confirmation the will pull the info from the sessions and send it.

[url=http://php.net/sessions]PHP SESSIONS[/url]

[url=http://php.net/mail]PHP MAIL[/url]
[/QUOTE]


The Sessions link is broken. You must know I am PHP-tarded; meaning I don't know it at all. I will look over the links (corrected) but will still need some guidance.

Am I to assume that I need to throw the code in and manipulate the location of which I want it to go (read: my email address)? With my current page, can I add the code to my javascript form to submitt it? I remember back in the day there was a simple mail to script for java but I'm sure I'm way past that point right now. SO LOST!!!!

I'm really lost right now and any sage-like guidance would help. Thanks in advance.

**[SIZE=7]EDIT[/SIZE]**

I just read the basic tutorial and updated the server to accept PHP documents. I've changed the confirmation page to confirm.php but now I get an "Notice: Undefined index: newMail in E:miscomputer.comConsortaDesktopconfirm.php on line 41" error. Here is my PHP code for that page:

<?php

if($_GET['newMail']){

$to = "[email protected]";

$email = $_
POST['email'];

$headers = "From: <$email>n";


$headers = "Content-Type: text/plain; charset=iso-8859-1n";

$subj = "Inquiry";

$details = "Contact: ".$_POST['contact']."n";

$details = "Email: ".$email."n";

$details = "Message:n".$_
POST['message'];

mail($to, $subj, $details, $headers);

header("Location: http://www.miscomputer.com/consorta/desktop/confirm.html");

exit;

}?>
Copy linkTweet thisAlerts:
@SheldonNov 21.2005 — [code=php]
<?php
if($_GET['newMail']){
$to = "[email protected]";
$email = $_POST['email'];
$headers .= "From: $emailrnReply-to: $email"; /*added reply to, not needed, but nice all the same */
$headers .= "Content-Type: text/plain; charset=iso-8859-1n"; /* added the point else two vars with the same name is not sood good */
$subj = "Inquiry";
$details .= "Contact: ".$_POST['contact']."n";
$details .= "Email: ".$email."n";
$details .= "Message:n".$_POST['message'];
mail($to, $subj, $details, $headers);
header("Location: http://www.miscomputer.com/consorta/desktop/confirm.html");
exit; /* Do we need the ext? - questino to other developers? try with and try with commenting it out.*/
}?>
[/code]


Your error says line [b]41[/b]? That script cant be any more than 15 lines? Are you sure that there is nothing else on the page?
Copy linkTweet thisAlerts:
@NogDogNov 21.2005 — To get rid of the error message, change...
[code=php]
if($_GET['newMail']){
[/code]

...to...
[code=php]
if(!empty($_GET['newMail'])){
[/code]
Copy linkTweet thisAlerts:
@PharmerGuyauthorNov 22.2005 — Awsome work NogDog! The error is toast. But now when I fill out the form and click submitt, I don't get an email. My page code is entirely too long to post so the link is below.

I want the computer configuration from the build page AND the form they fill out at the bottom to email to me but after filling it out, I don't get an email. Do I need another document on my server to route the email or should the code within the confirm.php take care of this?

Did I do something wrong?

http://www.miscomputer.com/consorta/desktop/confirm.php

Regardless, thank you all for your help in advance. MUCH APPRECIATED!
Copy linkTweet thisAlerts:
@SheldonNov 22.2005 — We can see your php code, as i said in this [url=http://www.webdeveloper.com/forum/showpost.php?p=467988&postcount=8]post(8)[/url] you need to use sessions.

Your fisrt page will submit to the second page, add alll the variables into sessions, populate the results on the second page with the sessions then when the user submits the second page it will pass the sessions from the first page and the data from the details form to the send mail script.
Copy linkTweet thisAlerts:
@PharmerGuyauthorNov 23.2005 — We can see your php code, as i said in this [url=http://www.webdeveloper.com/forum/showpost.php?p=467988&postcount=8]post(8)[/url] you need to use sessions.

Your fisrt page will submit to the second page, add alll the variables into sessions, populate the results on the second page with the sessions then when the user submits the second page it will pass the sessions from the first page and the data from the details form to the send mail script.[/QUOTE]


I don't really understand. The first link; Sessions, is a dead link. The second means nothing to me. Why can't I pull the script from the confirmation screen onto an email?

I'm simply trying to understand so I can get this done. Are you saying I need to rewrite the confirm.php script completely? It pulls from the previous page's script (which is all java) onto a confirmation grid for approval. The client then adds their mail to info, billing, etc. and then it emails me direclty the confirmation page with the build and billing info the client filled in.

As of right now, I have it in a mix between Java and PHP. I want to take the two "/forms" that are on that page which are the system build and the client billing info and have them emailed to me directly.

Is there a way to make this happen that I can understand? Like I've said; I am 10% with this php stuff and about 30% with java. I need all the help I can get and appreciate every little bit of it from everyone here.
×

Success!

Help @PharmerGuy 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 6.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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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