Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello again! I'm cracking my head again. I'm got a form that uses a mailto to send info. The problem is, this gets annoying to check and in some os'es the email client comes up and it gets annoying. AS a result, I've been wanting to make the submission create a file on the directory, which I can access when I want to. I've been told I can do this using cgi, but am at a total loss using cgi. At the moment, this is what I have:
<form action="mailto:login@host.com" method="post" enctype="text/plain">
I believe, that by changign the action, this should do it, yet google comes up with hundreds of things which dont relaly relate. Any hints?
Thanx, Spinal

What's wrong with that? Depending on the connection, after they have filled in a form, the email client pops up for about a second, then disappears again.
If you want free CGI and hosting, check out cutandpastescripts.org (I think it still exists).
Poor Stevie. They never did find his head.

Well, depending from the OS and browser, the form can be sent blank, the form arrives corrupted ATTACHED (odd) and on many version of linux, it pops up and stays up until send is clicked. I have been experimenting with PHP and have come up with this (thanx to people on the site who's code this is based on)
3 files:
post.php
---------------
<?
//Grab form data and put it in some variables
$name = $HTTP_POST_VARS['name'];
$login = $HTTP_POST_VARS['login'];
$IP = $HTTP_POST_VARS['IP'];
$password = $HTTP_POST_VARS['password'];
$email = $HTTP_POST_VARS['email'];
$comment = $HTTP_POST_VARS['comment'];
$Personal = $HTTP_POST_VARS['Personal'];
$Friends = $HTTP_POST_VARS['Friends'];
$VIP = $HTTP_POST_VARS['VIP'];$date = strftime("%d %b %Y", time());
$time = date("g:i a");$date = strftime("%d %b %Y", time());
$comments = preg_replace("/<.+?>/","",$comments);

Your problem is probably a pretty simple one, but the code is tough to decipher with all these formatting problems.
Why don't you upload the .php file as .txt and post it on your site. This would allow us to see it a little more clearly.
As a side note, using mailto: as the action for a form is absolutely vile. It only works on a very small percentage of your users (the ones that have a properly set up mail client and don't mind giving you their real address).
Since php obviously works on your server, there's no need for this, but for future people with a similar problem, don't use mailto, use hostedscripts.com, which is a free service that will take your form data and e-mail it to you.
-SN

Wait a second...I got a 500 error on that link...That shouldn't have happened. Your PHP file should not be set to execute. Is it in a cgi-bin kind of directory? Did you chmod it to be executable? If so, chmod it to not be executable, and get it out of cgi-bin.
Your server setup may also be wrong.
-SN

Hello again. Thanx for the help! Yeah, I realise mailto's are vile, that's why I'm trying to get rid of them. I have checked the php file, it is set on 644 (owner read/write; all others just read).
Here is a link for the php file as txt:
http://www.doc.ic.ac.uk/~md103/addmeform/contents/post.txtI have also allowed execution on the folder:
http://www.doc.ic.ac.uk/~md103/addmeform/contents/
so you should be able to see that too.
As for php setup on the server; I am running several other PHP scripts (tiny embedded ones, but php none-the-less) here and there, so I assume its working. As for the folder being a cgi-bin (im assuming it means a binary folder hence where programs would be stored, I dont have the slightest clue, lol)
Thanx,
Spinal

Not sure if tis any help to you or other but i used http://allforms.tripod.com/cgi-bin/page.cgi?link=/formsetup.html and it works a treat.
DOesn't do files though, sends to email.

WOW! Thanx so much! Although I will pursue this matter further (I need to figure out why the php script wasn't working). That site is great! So simple, and so versatile. Thanx again!
Spinal

If you want versatile and have a cgi-bin folder, you could use ennyfrms, which allows multiple forms. They share a single script by forms having their own ID and elements.

You need to check the permission settings on the directory and file that you want us to see. Here's the response I got.
Forbidden
You don't have permission to access /~md103/addmeform/contents/post.txt on this server.Forbidden
You don't have permission to access /~md103/addmeform/contents/ on this server.*******
I primarily work with Perl and only yesterday started to work with php, so I probably won't be able to help all that much, but thought I'd throw in my 2 cents.
Why is it that I see, both here and other similar php posts, recomendations for using external sources for processing and emailing the form data back to you? Using one of the many Perl (SMTP) modules, this could be handled on your end within the same script script the form is in, or by passing it to a seperate cgi script within your site. This would allow you to have full control over how the form is processed and emailed. I could be wring, but I think php has similar capabiltity.

Hello! Yeah, php has the ability to do that, but I can't seem to get it to work. I guess for the moment, external sscripts will be what ill use. On a separate note, when I finally get around to buying a php book, Ill try to get my own forumn up (at the moment Im using the bravenet ones, not too bad, pretty customisable, but they tend to get buried under the ads). But thanks, for the tutorial page, its a step forwards In my learning some php!
Oh and SN, I did try hostedscripts, but the link doesn't work. Anyways, thanx to everyone! Ill probably be asking more php questions as I work with it!
Spinal

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |