Form fill & send on web page

D

DG

I would like to set up a fill in form for questions or comments on a web
page (created using Word) that by clicking 'submit' the form automatically
gets sent to my email address. Is this possible without the person's email
software popping up? I'm using Word 2000 but also have Word 2002 at home if
there is a feature that would help do this. Thanks in advance for any help
provided.
 
G

Galen

In DG had this to say:

My reply is at the bottom of your sent message:
I would like to set up a fill in form for questions or comments on a
web page (created using Word) that by clicking 'submit' the form
automatically gets sent to my email address. Is this possible
without the person's email software popping up? I'm using Word 2000
but also have Word 2002 at home if there is a feature that would help
do this. Thanks in advance for any help provided.

What sort of hosting features do you have at the site where you post this
webpage? That's the starting point for a question like this. As for doing it
in Word I don't think so though you could edit the PHP, ASP, or PERL in Word
but I wouldn't recommend that either as Word is likely to add additional
code to the actual output and the scripts would then break. Depending on
what you want to accomplish it's really pretty easy though.

--
Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/
http://kgiii.info/

"At present I am, as you know, fairly busy, but I propose to devote my
declining years to the composition of a textbook which shall focus the
whole art of detection into one volume." - Sherlock Holmes
 
D

DG

Galen said:
In DG had this to say:

My reply is at the bottom of your sent message:


What sort of hosting features do you have at the site where you post this
webpage? That's the starting point for a question like this. As for doing
it in Word I don't think so though you could edit the PHP, ASP, or PERL in
Word but I wouldn't recommend that either as Word is likely to add
additional code to the actual output and the scripts would then break.
Depending on what you want to accomplish it's really pretty easy though.

We are just setting the page up, it isn't online yet. I was using Word to
create our pages and I found the "Web Tools" toolbar. Since it had form fill
buttons, submit, reset, etc., I assumed there would be a way to use these on
a web page. This is our first attempt at a web page and I see we have a lot
to learn. I'll start with the ISP we plan to use for hosting. Thanks so much
for your reply.
 
G

Galen

In DG had this to say:

My reply is at the bottom of your sent message:
We are just setting the page up, it isn't online yet. I was using
Word to create our pages and I found the "Web Tools" toolbar. Since
it had form fill buttons, submit, reset, etc., I assumed there would
be a way to use these on a web page. This is our first attempt at a
web page and I see we have a lot to learn. I'll start with the ISP we
plan to use for hosting. Thanks so much for your reply.

Not a problem but look out for folks who will charge you for something so
simple. You can actually BUY scripts that do this for you. Personally I
think that's pretty silly... It looks hard but it's actually either really
easy or free.

If you'd like you can just have mine?

Here's the simplest version:

http://kgiii.info/email_gxgxg.html

So if that's what you're looking for I'll just code you one based on mine.
It uses straight PHP sendmail() function and is VERY basic to edit... (You
can even send me a message through there if you absolutely wanted to test it
but please don't send me too many.)

If you wanted to be fancier with it - believe it or not this is the "same"
script with just about 2 minutes worth of editing:

http://www.whathostingshould.be/order/order.html

You can test that one but PLEASE not too many times. ;) That is - in all
actuality - the same script that runs it...

The HTML is right there on the page (right click > view source) and here:

I'll comment it some... You'll need to keep it pretty secure so we're only
going to let results be parsed from one header/page...

You'll need a thank you page... (I'll leave my links in there. I did remove
the email.)

You'll need an error page....

***************** Copy below - not this ****************

<?
/*
Order Form

*/

// ------------- FEEL FREE TO ALTER THE STUFF BEGINNING WITH $ (leave the $
though) ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "(e-mail address removed)" ;

$mailto = '(e-mail address removed)' ;

// $subject - set to the Subject line of the email, eg
//$subject = "Your Feedback Form" ;

$subject = "Order Form" ;

// the three page pages to be displayed, eg
//$formurl = "http://example.com/feedback.html" ;
//$errorurl = "http://example.com/error.html" ;
//$thankyouurl = "http://example.com/thankyou.html" ;

$formurl = "http://whathostingshould.be/order/order.html" ;
$errorurl = "http://whathostingshould.be/order/ordererror.html" ;
$thankyouurl = "http://whathostingshould.be/order/ordercomplete.html" ;

// -------------------- EDIT BELOW ONLY IF YOU KNOW WHAT YOU'RE
DOING ---------------

$name = $_POST['name'] ;
$address = $_POST['address'] ;
$city = $_POST['city'] ;
$state = $_POST['state'] ;
$zipcode = $_POST['zipcode'] ;
$phone = $_POST['phone'] ;
$email = $_POST['email'] ;
$plan = $_POST['plan'] ;
$domain = $_POST['domain'] ;
$transaction = $_POST['transaction'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($address) || empty($city) ||
empty($state) || empty($zipcode) || empty($phone) || empty ($plan) ||
empty($domain) || empty($transaction)) {
header( "Location: $errorurl" );
exit ;
}
$name = strtok( $name, "\r\n" );
$email = strtok( $email, "\r\n" );
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .

"Name: $name\n" .
"Address: $address\n" .
"City: $city\n" .
"State: $state\n" .
"Zip/Postal: $zipcode\n" .
"Phone: $phone\n" .
"Email: $email\n" .
"Plan: $plan\n" .
"Domain: $domain\n" .
"Transaction Number: $transaction\n" .


"------------------------- COMMENTS -------------------------\n\n" .


$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper, "From: \"$name\"
<$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php
2.04" );
header( "Location: $thankyouurl" );
exit ;

?>
***************** Copy Above this line - don't copy this *****************

Rename that <something>.php

Here's the HTML code....

****************************************************************
<center>
<b><u>FILL IN ALL FIELDS</u></b>
<form action="order.php" method="post">
<table cellspacing="8" summary="order form">
<tr><td>Name:</td><td><input type="text" name="name" size="25"></td></tr>
<tr><td>Address:</td><td><input type="text" name="address"
size="25"></td></tr>
<tr><td>City:</td><td><input type="text" name="city" size="25"></td></tr>
<tr><td>State:</td><td><input type="text" name="state" size="25"></td></tr>
<tr><td>Country:</td><td><input type="text" name="country"
size="25"></td></tr>
<tr><td>Zip/Postal Code:</td><td><input type="text" name="zipcode"
size="25"></td></tr>
<tr><td>Phone Number:</td><td><input type="text" name="phone"
size="25"></td></tr>
<tr><td>Domain name:</td><td><input type="text" name="domain"
size="25"></td></tr>
<tr><td>Contact Email address:<font color="#cc0033">*</font></td><td><input
type="text" name="email" size="25"></td></tr>
<tr><td>Plan Ordered:</td><td><input type="text" name="plan"
size="25"></td></tr>
<tr><td>Transaction Number:</td><td><input type="text" name="transaction"
size="25"></td></tr>
<tr>
<td colspan="2">
Additional Comments:<br>
<textarea rows="5" cols="45" name="comments">
</textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<p>By submitting this order you agree abide by the terms of service.</p>
<input type="reset" value=" Reset Form " class="button"> <input
type="submit" value="Place Order" class="button"><br>
</td>
</tr>
</table><p>
<font color="#cc0033">*</font>Please avoid using an email address that will
reside on the server. That way if we need to contact you when there's an
issue with the server we will still be able to do so.</p>
</form>
</center>
***********************************************************


You can play with it quite a bit. You can change fonts, fields, etc. 3rd
line down - see the line with order.php? Whatever you named the first file
you'd simply change the order.php to reflect that - say contact.php for
example. If it was on an alternate page (let's say it - the contact.php was
in public_html/contact/script/contact.php for this one) and you were all the
way over in public_html/my_products/about_us/ and you wanted to only have to
upload it once then you'd use "./../script/contact.php" or
".../script/contact.php" though I think it's the first and not the latter.
Personally I'd just use the contact as a link and send them to the form
itself rather than replicate it all over the place.

Now if you go back to the PHP... ;)

Look for the "if (empty($foo) ||" values..

Scroll down and look at the same value...

Scroll down again and look at the same value...

The first one says - you gotta fill everything in.

The second one says what it's going to do with it - it's going to POST it
(send it) basically.

The third one says how (and where) it's going to include it in the email you
get.

If you don't want to have ALL those fields you'd kill the "if (empty($foo)
||" value.

You *can* leave the rest of them but don't bother - it's just going to make
a CPU cycle but PHP is pretty capable of dealing with silliness and
shouldn't throw any errors that either you or the end-user will see.

Never alter the script to include a blank email address... SPAMers will find
it and be all over it.

Last, but not least, edit the above in a true text editor like Notepad.
Don't do it in Word or WordPad. JUST a true text editor.

I don't dare spell check this.

--
Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/
http://kgiii.info/

"At present I am, as you know, fairly busy, but I propose to devote my
declining years to the composition of a textbook which shall focus the
whole art of detection into one volume." - Sherlock Holmes
 
D

DG

My reply is at the bottom of your sent message:
Not a problem but look out for folks who will charge you for something so
simple. You can actually BUY scripts that do this for you. Personally I
think that's pretty silly... It looks hard but it's actually either really
easy or free.

If you'd like you can just have mine?

Here's the simplest version:

http://kgiii.info/email_gxgxg.html
Last, but not least, edit the above in a true text editor like Notepad.
Don't do it in Word or WordPad. JUST a true text editor.

Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/
http://kgiii.info/

Thank you - I really appreciate the help you've provided!! Just a few
questions. I assume the first thing I have to do is contact my ISP and make
sure they support PHP script?? And this script will just email their
comments right to me with no other software required from the person who
submits the comment or at my end except my email software to receive the
message?? So I would be creating two files - the PHP script and the html
form file - using Notepad. Can the thank you and error pages be created in
Word so I can use the same fonts as the website? Sorry for the questions -
I'm new to this!
 
G

Galen

In DG had this to say:

My reply is at the bottom of your sent message:
Thank you - I really appreciate the help you've provided!! Just a few
questions. I assume the first thing I have to do is contact my ISP
and make sure they support PHP script?? And this script will just
email their comments right to me with no other software required from
the person who submits the comment or at my end except my email
software to receive the message?? So I would be creating two files -
the PHP script and the html form file - using Notepad. Can the thank
you and error pages be created in Word so I can use the same fonts as
the website? Sorry for the questions - I'm new to this!

No offense intended when I say - yes it's obvious that you're new at this.
Don't worry - everyone that does it was new at one point or another and it's
not really as hard as you might think though at first it can seem a little
daunting.

Now... Don't make it in Word. :p

Didn't we just go over that? *grins* Anyhow yes, yes you can.

Take a gander at something like this:

http://www.nvu.com

Are you using an ISP that also provides your internet connectivity? If so
then you probably don't have PHP, MySQL, PERL, etc... A web page is fine on
such things assuming you don't want any dynamic content or the likes.
Low-cost hosting is out there but you're probably more interested in someone
who's going to assist you with making the pages or the likes. If that's the
case then looking into a CMS (content management system) might be a viable
option for you and many hosting companies offer web hosting with cPanel,
Fantastico, etc and the ability to install that stuff with just a simple
click.

If, for security reasons, you're not feeling comfortable revealing your
hosting service provider then you can email me simply enough. The address is
right here in the reply-to field or you can simply click:
(e-mail address removed) and one can usually get the information about what the
hosts have enabled or not.

--
Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/
http://kgiii.info/

"At present I am, as you know, fairly busy, but I propose to devote my
declining years to the composition of a textbook which shall focus the
whole art of detection into one volume." - Sherlock Holmes
 
D

DG

My reply is at the bottom of your sent message:
No offense intended when I say - yes it's obvious that you're new at this.
Don't worry - everyone that does it was new at one point or another and
it's not really as hard as you might think though at first it can seem a
little daunting.

Now... Don't make it in Word. :p

Didn't we just go over that? *grins* Anyhow yes, yes you can.

Are you using an ISP that also provides your internet connectivity? If so
then you probably don't have PHP, MySQL, PERL, etc... A web page is fine
on such things assuming you don't want any dynamic content or the likes.
Low-cost hosting is out there but you're probably more interested in
someone who's going to assist you with making the pages or the likes. If
that's the case then looking into a CMS (content management system) might
be a viable option for you and many hosting companies offer web hosting
with cPanel, Fantastico, etc and the ability to install that stuff with
just a simple click.

Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/
http://kgiii.info/

No offense taken - I feel the same way when I have to help someone figure
out how to change the margins in Word :))) I did understand not to use Word
for the PHP script and form - I promise - I'll used Notepad!!! But I still
need one clarification - is the PHP script a SEPARATE file from the form
file?? ....my "PHP for Dummies" status is showing again :((

There is good news - I called my ISP, they DO support PHP. For what we
intend to do, a very simple information type website, we won't need anything
complex at this point and that is why I'm trying to create most of the site
in Word so it will be easy for others to modify it if necessary. I've
finished the majority of pages we intend to use so I hate to start over with
another program. I did look at the Nvu site and downloaded the software but
when I try to open the files I created in Word I get the message "This page
can't be edited for an unknown reason".

Thank you so much for all of the help you've provided!!
 
G

Galen

In DG had this to say:

My reply is at the bottom of your sent message:
No offense taken - I feel the same way when I have to help someone
figure out how to change the margins in Word :))) I did understand
not to use Word for the PHP script and form - I promise - I'll used
Notepad!!! But I still need one clarification - is the PHP script a
SEPARATE file from the form file?? ....my "PHP for Dummies" status is
showing again :((
There is good news - I called my ISP, they DO support PHP. For what we
intend to do, a very simple information type website, we won't need
anything complex at this point and that is why I'm trying to create
most of the site in Word so it will be easy for others to modify it
if necessary. I've finished the majority of pages we intend to use so
I hate to start over with another program. I did look at the Nvu site
and downloaded the software but when I try to open the files I
created in Word I get the message "This page can't be edited for an
unknown reason".
Thank you so much for all of the help you've provided!!

Did you save the word documents as HTML? If not then NVU might have issues -
instead try creating a new document with NVU and just pasting the contents
into the preview window or something and it might be amazing for you - and
it will go ahead and render it valid too. An added bonus.

Anyhow...

Yes, the PHP is a separate file. There are two or three HTML files (all
pretty basic) and one PHP file. They can all be a very simple template or
what not and just a "thank you" or a "oops" type of page. The first, the
contact page, takes the form fields and passes them to the PHP file which
then decides (based on criteria defined within) to pass it on to the email
address via the sendmail function which keeps folks from using it for
SPAM/UCE etc...

If you ping me off-list then I'll go ahead and code it up for you if you
have a template or something. It doesn't take more than a few moments to do
once you get used to it. I'd need to know, of course, the email address (I'd
advise against posting that in a public newsgroup) and what fields you want.
Given the context of your questions it seems likely that you'd want
something pretty simple as is found on the G³ Solutions contact page. If
that's the case then it's a matter of a few edits and it's your's.

--
Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/
http://kgiii.info/

"At present I am, as you know, fairly busy, but I propose to devote my
declining years to the composition of a textbook which shall focus the
whole art of detection into one volume." - Sherlock Holmes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top