Re: How do I insert a cgi script into Publisher page?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hey Spike,

As you were working out your PHP form, did you happen to run across this
site:
http://www.jamesshuggins.com/h/hefs/huggins-email-form-script.htm

If you have not, you might find it interesting.

DavidF

"Spike" <zero_spam@xxxxxxxxxx> wrote in message
news:%23LX9%23u6tJHA.5684@xxxxxxxxxxxxxxxxxxxxxxx
Monika

OK, here is the code and instructions that I prefer for simple form mail
*******************
copy the following code and paste into notepad
modify the code to fit your needs
save it as: mailer.php
in publisher, create your form and in the form properties action snould
read:
mailer.php (if the php is in the same folder as the form) if in another
folder then /folder name/mailer.php
*******************
How to modify the code:
CHANGE "E MAIL ADDRESS" to your email address between the quotes
CHANGE "SUBJECT OF MESSAGE" to subject you want on the email between
the
quotes
CHANGE "From: XXXXXXXX"; REPLACE XXXXXXXX with your web site name
$forward = 1; leave a 1 if you have a thank you page if not make it a
0 (zero)
$location = "thank_you.htm"; if you have a thank you page it should be
named thank_you.htm or modify the line to show your page

The "mailer.php" and the "thank_you.htm" MUST be in the same folder as the
form page. If not the links must
be modified.
*******************

Code Starts on Next Line with <?PHP

<?PHP
$to = "E MAIL ADDRESS";
$subject = "SUBJECT OF MESSAGE";
$headers = "From: XXXXXXXX";
$forward = 1;
$location = "thank_you.htm";

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



$msg = "Below is the result of your feedback form. It was submitted on
$date
at $time.\n\n";

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, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for submitting our form. We will get back to you as
soon
as possible.";
}

?>

END OF CODE: Code Ends with ?>

Spike



"Monika" <Monika@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:278E51DD-57AF-4F5B-8FB2-05770B3C028B@xxxxxxxxxxxxxxxx
Spike,

My host is www.swissnetsolutions.ch and yes, they do support PHP
apparently.

Thank you very much.

Monika

"Spike" wrote:

Monika

Who is your hosting service? Do they accept PHP files? PHP is much
simpler
than CGI since the host does not provide one.

Spike

"Monika" <Monika@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A4C581E3-12A5-480E-BF94-57FB3F598D00@xxxxxxxxxxxxxxxx
David, Spike,

Me again. I see that you have really been active on this matter. I am
duly
impressed.

After contacting my host, I was told that they do not have a cgi form
handler file available. Well, well. I should get one from the web. I
found
under www.skymarket.co.uk/help_cgiscripts.php one which seems to be
quite
straight forward.

However, my questions is. Has any of you ever heard of this one? And,
once
downloaded, one should point the form to this script with the
following
command:

<form method="post"
action="http://www.yourcompany.co.uk/cgibin/FormMail.cgi";>
< input type="hidden" name="recipient"
value="formresponse@xxxxxxxxxxxxxxxxx">
< input type="hidden" name="subject" value="Online Form response">

Do I really have to input all of this info or only until
/FormMail.cgi?
What
does the rest of this command do?

I am really grateful that you are so helpful. It is very much
appreciated.

Thank you.

Monika

"DavidF" wrote:

Works here too. You are hereby deemed the forms guru! ;-)

DavidF

"Spike" <zero_spam@xxxxxxxxxx> wrote in message
news:egrLWOYtJHA.1492@xxxxxxxxxxxxxxxxxxxxxxx
David

The verify form is working
Check it out here (my test site)
http://www.gizmomind.info/mail/

The other PHP works for me but not on some servers of the FREE
variety
Posted the other one on Cannot find page-cgimail thread

Spike

"Spike" <zero_spam@xxxxxxxxxx> wrote in message
news:#PpQ9e6sJHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
David

Good response. Each time I write ISP I keep telling my self that
someone somewhere is going to go to AOL and look for their site,
then I
get over it. You are correct, I should refer to the hosting
service.
I
use to do absolute paths until I figured out the relative ones.
As
you
said, there are some newbie's here and absolute is better to get
things
started. I do have some PHP things I am working on that REQUIRE
absolute
paths. As far as the help areas, when people post their hosting
service
I go to my search engine and enter forms and the hosting service
and
most
of the time I get what I need. That seems faster than going on
line
to
the host and looking for help. Example: enter forms godaddy into
Google
and scroll down to the godaddy link
"http://help.godaddy.com/article/512"; and there it is.

I have two PHP mailers just about ready. One is a straight
forward
form
mailer working with publisher forms and the other is script form
that
requires the sender to put in a 4 number code to send (stops
spammers).

Spike

"DavidF" <Nope@xxxxxxxxxx> wrote in message
news:uzLjc85sJHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
Spike,

Good job. I will try to follow the instructions myself when I
have
time
to see where or if things are unclear to me. A few first
impressions
though:

Though Publisher uses 'ISP' I think that may be confusing to some
as
my
ISP is not where I host my website. Instead of using just 'ISP',
perhaps
it would be useful to define 'ISP/website host' at least the
first
time
you use ISP or just use 'website host' instead. Perhaps this is
picky
as
I knew what you meant, but others might not.

You alluded to this several times, but you might be more specific
about
how different ISPs/Website hosts offer different form handler
programs,
and that the user should go to their webhost 'help' section, or
perhaps
'Support', 'Knowledge Base' or maybe even 'FAQs section' to find
what
form handler the host supports and the directions for using their
form
handler. From my experience of going to the various hosts this
information can be hard to find sometimes, so I also always look
for
a
search field in the 'help' section and search for 'forms'. That
almost
always saves me time in finding the information. I am of course
not
suggesting that you use all these words, but perhaps in your own
more
succinct style ;-), give the poster a little more direction of
how to
find what forms their host supports and how to find the
directions.
Once
they do, chances are your directions will be work in general
regardless
of what forms handler program they have.

You and Don tend to use relative links and paths, but I think
that it
might be more clear if posters use absolute links/paths in
general.
For
example when you double click the submit button, and then the
'form
properties' button, and the 'use a program from my ISP' then this
is
what is given as the sample link:
http://example.microsoft.com/~user/ispscript.cgi I guess what I
am
saying is that people can sometimes understand an absolute link
easier
than they can a relative one.

I will try your directions to see if I can follow the rest but it
looks
like good information. I will look forward to trying out your PHP
directions too. Thanks for taking the time to write this up. I
think
helping people move away from FPSE is a good idea...especially
since
they can use FTP uploading.

DavidF


"Spike" <zero_spam@xxxxxxxxxx> wrote in message
news:Om2AXQxsJHA.2532@xxxxxxxxxxxxxxxxxxxxxxx
David

I put together a routine that I use with success: Look it over
please
and see if I make sense. I will do another one for PHP. I am
leaning
towards PHP more and more as it is somewhat easier if you like
modifying scripts.

======
CGI Mail form
If your ISP supports cgi and has a form handling program then a
form
created in publisher will function using FTP upload rather than
front
page server extensions to upload the pages.

You must tell the server what e mail address you want the form
results
sent to. Some ISP's are different than others. Check with the
ISP
help section on handling forms for that information.

Locate the cgi form handler file on the server. It is probably
in
the
cgi or cgi-bin folder. Again ISP's are not all the same.

For example, if the form handler is in the cgi folder and it is
named
myform.cgi then the path for the handler in publisher will be "
/cgi/myform.cgi " without the quotes.


In publisher create a page for your form and build the form.
In the form properties window select "Use a program from my ISP"
In the action section insert the path you discovered above.
Example
for godaddy.com is " /cgi/gdform.cgi " without the quotes.

From method is Post

In the hidden fields window: enter under Item "subject" no
quotes
an
in the item value for subject enter a subject line that you want
on
the
form when you receive it.


Below the subject enter "redirect" no quotes if you want have a
thank
you page built and in the item value enter the path to your
thank
you
page

Example: " /thank_you/thankyou.htm " the thankyou.htm file is
located
in the thank_you folder in the root directory.
The thank you page may have a link back to the page where you
came
from
or any where else you so desire or an auto redirect script with
a
delay.
The auto redirect script is inserted using the HTML fragment
function
and looks like:

<meta http-equiv="Refresh" content="4; url=/index.htm">

In this case the time delay is 4 seconds and the page that will
come
up
is the index.htm.

=========

"DavidF" <Nope@xxxxxxxxxx> wrote in message
news:uq5TZ$vsJHA.4968@xxxxxxxxxxxxxxxxxxxxxxx
Spike is the one with the most experience with using something
other
than FrontPage Server Extensions to power the forms, so
hopefully
he
will jump into this thread and offer some more information. But
in
the
meantime...

I don't think you will have to "name your order form". I think
what
Spike was suggesting was that the way you wrote the link was
incomplete, and that you needed to add the extension. I would
just
try
it and see what happens. One thing to keep in mind is that
unless
you
make that link an absolute link instead of a relative link, it
won't
work from your local computer. It is looking for the cgi folder
on
your server when you use the relative link. So you may have to
upload
your pages in order to test it.

Here is another resource for you that might help explain the
forms
in
Publisher:
Reference: Web forms:
http://office.microsoft.com/en-us/publisher/CH063576891033.aspx

If you test it and it still doesn't work as per Spike's
suggestions
after uploading the pages, then post back and let us know. Also
provide us a link to your host and specifically where on the
host
website it gives you the instructions for using the forms
program
in
the cgi folder. Then perhaps we can help further.

DavidF


"Monika" <Monika@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6311AA11-01D7-45E5-97D3-7FE0D0E55A91@xxxxxxxxxxxxxxxx
Oh, I did not know that David B has been inactive for some
time.
But
now
looking at the date ...

Anyway, yes, I saw Spike's advise and it was very helpful to a
certain point
( I now know whre to put the command) but did not solve my
problem.
His
command was /cgi/myform.cgi. Does this mean that I will have
to
name
my order
form. In fact, I inserted this order form by using one of the
templates and
would not know if this one has a name and were to find it.

Sorry, if I sound a little daft but since this is my very
first
website, I
am a little lost presently :-). Thank you very much for your
support.

Monika

"DavidF" wrote:

David Bartosik has been inactive for a number of years now,
so I
wouldn't
hold my breath waiting for an answer from him.

I see that Spike answered your other post. Did that give you
enough



.



Relevant Pages

  • Re: login example
    ... perl or cgi or php. ... As I know then free hostings not allow to run cgi, php or MySQL. ... You must select some cheap provider or get static and public IP address from your ISP and run your own webserver at home. ...
    (comp.lang.perl.misc)
  • Re: Send button on order form
    ... Log into the host server and locate the cgi or php script file that you are going to use. ... Most ISP's use a separate folder for their scripts. ...
    (microsoft.public.publisher.webdesign)
  • Re: Looking for PHP modular expt, i.e. pwrmod, library
    ... in PHP using my wheel-reinvent alternate-to-bcmath, ... host that provides PHP service with bcmath and also provides ... SSH from my current Unix shell account which is available to me at ... 1.5 seconds to process a public-key signed ...
    (comp.lang.php)
  • Re: working with mysql
    ... throw new Exception('Error connecting to host. ... I would like to be able to get php to pull the data. ... Did you take out your throw statement and put in the echo like I asked? ...
    (comp.lang.php)
  • Re: Send button on order form
    ... host does not support FPSE but PHP or CGI. ... I have now idea what to do in order get this order form page working. ... And how do I then tell the submit button to either use PHP or CGI. ...
    (microsoft.public.publisher.webdesign)