FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > General Site Owner Support (All may read/respond) > PHP, Perl, Python and/or MySQL
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 01-06-1999, 04:08 PM   Postid: 42286
Jacob Stetser
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Dec 1998
Location: Decatur, GA 30032
Posts: 447
Dual-mail PHP script...

I'm trying to get a modified form-mail script to work.. it originally mailed a message to one person and I want it to mail a different message to the person who submitted the comment and their comments to me...

the form is at http://www.icongarden.com/form.html and the source of the script is located here: http://www.icongarden.com/fmail.phps

My problem is that the first mail, the mail to "me" as owner, goes fine, with all fields filled in with the right information.

But the second mail looks like the template I feed in from the form at form.html... there's no substitution going on.

It all leads me to think my problem is in the

Â*Â*ifÂ*(isset($template_user)) // or $template
bla bla bla
else
bla bla bla

area... Do I need to store the environment variables or something? Do they disappear when used once in the script?

Help!
Jacob Stetser is offline   Reply With Quote
Old 01-06-1999, 05:42 PM   Postid: 42287
 Deb
FutureQuest, Inc.
 
Deb's Avatar
 
Join Date: Jun 1998
Location: Franktown Colorado
Posts: 6,781
Well, for what it's worth you have answered one of the questions I had had about mailers.... but as for your question... I know what's wrong with it, but due to my lack of skills in scripting I can not tell you how to fix it.

if (isset($template))
{
// Fill in variables into the template
while (list($header, $value) = each($HTTP_POST_VARS))
{
$template = ereg_replace("%".$header."%", $value, $template);
}
}
else
{
// Simply add variables line by line
while (list($header, $value) = each($HTTP_POST_VARS))
{
$template = "$template\n$header: $value";
}
}

if (isset($template_user))
{
// Fill in variables into the template
while (list($header, $value) = each($HTTP_POST_VARS))
{
$template_user = ereg_replace("%".$header."%", $value, $template_user);
}
}
else
{
// Simply add variables line by line
while (list($header, $value) = each($HTTP_POST_VARS))
{
$template_user = "$template_user\n$header: $value";
}
}

With this you are saying "if yes then change it to no" so it goes and changes it to no... then you say again "if yes change it to no.." but it of course is not going to be 'yes' because you have already changed it to no.

Which means something like a 'while loop' or something of that sort is needed... to anyone with a bit of knowledge in the area probably easy fix... just for me personally I am not sure.

Deb
Back to the books....
Deb is offline   Reply With Quote
Old 01-07-1999, 01:14 PM   Postid: 42289
 Deb
FutureQuest, Inc.
 
Deb's Avatar
 
Join Date: Jun 1998
Location: Franktown Colorado
Posts: 6,781
See that's the problem... I WANT to use your idea too!!! I think it would come in handy but I'm not skilled enough to know exactly how to make it happen without digging into the dox... which I'll probably end up doing here pretty soon.

I know some perl coders would have the answer though -- we just half to entice them to get in here

Many would find use for this one.... Maybe if you could/would zip up the three files and make them available to everyone here someone else would say hmmmmm and make it work

Deb
p.s. some of us were wondering how to get the mail to not send from "php3@futurequest.net" this script answered that for me

[This message has been edited by Deb (edited 01-07-99).]
Deb is offline   Reply With Quote
Old 01-08-1999, 12:36 AM   Postid: 42288
Jacob Stetser
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Dec 1998
Location: Decatur, GA 30032
Posts: 447
Ok... hmm.. Glad I answered your question

I'm not quite sure _where_ I set the 'is this set, if yes to no'... is that the isset command? And anyhow, would

if (isset($template)) set $template_user to not set as well?

What seems to be happening is that the 2nd isset if/else statement isn't being executed at all.. because if isset($template_user) returned no, It'd still send an email with the correct values, just none of the stuff pulled in from the template..

i.e., instead of

Hello Jake, You said "Hi, you old dog" to me on my web site today. Thank you.

(from 'Hello %name%, you said "%comment%" to me on my web site today. Thank you.)

it would read

Jake
Hi, you old dog

...
I'm stuck...

Of course, I could go with the original script and have it feed into an autoresponder, but I like this method better because it lets me customize the message back to them to include what they wrote.

Thanks for your help
Jacob Stetser is offline   Reply With Quote
Old 01-08-1999, 03:21 AM   Postid: 42290
 Deb
FutureQuest, Inc.
 
Deb's Avatar
 
Join Date: Jun 1998
Location: Franktown Colorado
Posts: 6,781
Hey Jacob....

I say phooey to the coders out there that aren't helping us See if we let them in on our secrets as we fix this! *g*

I tried something different tonight and it worked!!! I wouldn't say it's exactly what you were asking for and I'm sure there are coders out there laughing at us but pfffttt heheeh

I changed the "send to visitor" part of the php file to the following

Quote:
// Send mail to owner
mail ("sales@FutureQuest.net", "$subject", "$template", "FROMfrom");

// Send mail to visitor
mail("$from", "We received your email!", "Hi $firstname $lastname\n
Thank you for your interest!\n
We sell fresh widgets daily over the Internet!
Place your order at http://www.midnightmerchants.com, and receive a free package of wachamacolits!\n
The following is what you sent us: we will be replying to $from just as soon as possible.\n
$comment", "FROM:Sales@FutureQuest.net");

// Goto success-page
Header("Location: $url_success");

// Good bye
?>
And removed the second hidden feild on the form.html

ergo -- defining the second email in the php file directly rather then trying to get it to read from the form twice... I think Andrew would call it "force feeding it until you figure out how to do it right" but either way it works so hmph!

Now if you have figured it out the other way... feel free to make me look silly and let me know

Deb
p.s. remember to remove the second hidden field from the form.. and you can probably remove all reference to the "template_user" as well if you utilize this idea

[This message has been edited by Deb (edited 01-08-99).]
Deb is offline   Reply With Quote
Old 01-08-1999, 03:31 AM   Postid: 42291
 Deb
FutureQuest, Inc.
 
Deb's Avatar
 
Join Date: Jun 1998
Location: Franktown Colorado
Posts: 6,781
There is still one problem with the whole thing no matter how we do it that I haven't been able to fix yet (this may be a job for Hearts, since she fixed this for me on the last form I had created *g*)

When the form is submitted via the Netscape browser everything works GREAT! But when the form is submitted via the MS Internet Explorer browser we get the 'double characters' at the end of each line in the email

Last time this fixed by fixing the syntax of the html form.. but this time I *think* the syntax that IE is fitting about is the long VALUE= for the template field... I don't think IE likes all the carriage returns and spaces etc.....

Ideas?
Deb

The test form I am using is at http://midnightmerchants.com/php/test/form.html
Deb is offline   Reply With Quote
Old 01-08-1999, 11:11 AM   Postid: 42292
Jacob Stetser
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Dec 1998
Location: Decatur, GA 30032
Posts: 447
Destroy MS!



That's my idea.

Well, I'll work on the problem and see if I can come up with a solution. Oh, and some cool news.. I may be able to trade some of my web presence building services in exchange for wedding photography (a $2500 value)

That'll save money. It's good having a talent!
Jacob Stetser is offline   Reply With Quote
Old 01-08-1999, 08:01 PM   Postid: 42293
 Deb
FutureQuest, Inc.
 
Deb's Avatar
 
Join Date: Jun 1998
Location: Franktown Colorado
Posts: 6,781
Ok,

I've deleted most of the php file that we started with lol

I use no $template at all with this and have changed the //send mail to owner to work the same way as //send mail to visitor works.. another case of force feeding.

To my surprise that did NOT fix the form! Even with the hidden field removed it was still sending me the dual characters at the end of each line... so by this point I'm ticked at IE cuz I couldn't strip the form any more then I already had.

BUT WAIT I fixed it! If you use wrap="physical" it is broke.. but if you use wrap="soft" then there are no dual characters...

BUT WAIT now there is a new problem If someone uses a single quote somewhere like "i've" type of thing then we get "i/'ve" in our emails.. it's adding backslashes to the single quotes... sigh

So back to the dox and in the php manual it shows how to add and remove backslashes... XXXVII. String functions click on AddSlashes then on StripSlashes... and there is our answer. But the various ways I've tried to add that string to the form has broken it....

So that's my update so far

Deb
Deb is offline   Reply With Quote
Old 01-09-1999, 05:29 PM   Postid: 42294
 Deb
FutureQuest, Inc.
 
Deb's Avatar
 
Join Date: Jun 1998
Location: Franktown Colorado
Posts: 6,781
Update on my learning curve....

Via much trial and error... my form now does the following....

For the visitor:
Start at 'step 1' fill out the info and click continue... pertinant information is carried over to 'step 2' and I'm now communicating with the visitor using information they gave me like their name etc and walking them through step 3 and step four of a five step process.... at step five they have filled in all the info on the form and click send...

At this point they are directed to the thank you page and three emails are sent out...
One to the visitor saying "thanks and telling them what they told me etc"
The other two to two seperate emails of my own.. from/to the correct addys etc...

It also is now hooked up the MySQL database which is setup to contain all of the fields on my big form and the info they enter is going into my database as it should...

====== Need to Learn Still...

1. Not a clue how to operate the DB yet so even though the info is there i've a lot of reading to figure out what to do with it etc...

2. I can not seem to get the form to REQUIRE any fields yet... it worked when it was just one form.. but now that i've broken it into pieces it's not working...

3. No dual characters at the ends of the lines via wrap=soft but I still have to get the strip function in for the /ing of the single quotes problem...

So that's where I'm at so far

Deb
Deb is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 11:54 AM.


Running on vBulletin®
Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2013 FutureQuest, Inc.
FutureQuest, Inc.