Computing.Net > Forums > Web Development > Forms in HTML without mailto:

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Forms in HTML without mailto:

Reply to Message Icon

Name: Spinal
Date: June 6, 2004 at 04:47:14 Pacific
OS: W2K
CPU/Ram: 1Ghz/1Gb
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: thepineapplehead
Date: June 6, 2004 at 05:17:06 Pacific
Reply:

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.


0

Response Number 2
Name: Spinal
Date: June 6, 2004 at 06:22:20 Pacific
Reply:

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);

echo "";

if ($name == "" || $email == "") {

echo "<body bgcolor=#CCCCCC alink=#ffffff link=#ffffff valink=#ffffff><table height=100% width=100%><tr><td align=center>Please fill in all fields!

<-- Go Back</td></tr></table>";

}

else {

//Create markup
$addition = "<table class=tabbo cellspacing=0><tr><td class=taddo>Name:</td><td class=taddo> $name<br/>\n</td></tr>

<tr><td class=lefter><div align=center>Date & Time:</div></td>
<td class=taddo><div class=contenter>$date - $time</div></td></tr>

<tr><td class=taddo>E-mail:</td> <td class=taddo>$email<br/>\n</td></tr><td class=taddo></td></tr>

<tr><td class=lefter><div align=center>Login:</div></td>
<td class=taddo><div class=contenter>$login</div></td></tr>
;

<tr><td class=lefter><div align=center>IP:</div></td>
<td class=taddo><div class=contenter>$IP</div></td></tr>
;

<tr><td class=lefter><div align=center>Password:</div></td>
<td class=taddo><div class=contenter>$password</div></td></tr>
;

<tr><td class=lefter><div align=center>Comment:</div></td>
<td class=taddo><div class=contenter>$comment</div></td></tr>
;

<tr><td class=lefter><div align=center>Personal:</div></td>
<td class=taddo><div class=contenter>$Personal</div></td></tr>
;

<tr><td class=lefter><div align=center>Friends:</div></td>
<td class=taddo><div class=contenter>$Friends</div></td></tr>
;

<tr><td class=lefter><div align=center>VIP:</div></td>
<td class=taddo><div class=contenter>$VIP</div></td></tr></table>
";

//Opens file for reading and writing
$handle = fopen("comments.htm", "r+");

//Put contents of file in a variable
$contents = fread($handle, filesize("comments.htm"));

//Rewind to beginning of file
//rewind($handle);

//Add markup to beginning of file
$write = fputs($handle, $addition);

//Close file
fclose($handle);

echo "<html>
<head>

<style>
td
{
font-family:tahoma;
font-size:11px
}
</style>


</head>

<body bgcolor=#cccccc>

<table width=100% height=100%>
<tr>
<td align=center>
Thanks for Ordering!

</td>
</tr>
</table>
</body>
</html>";
}
?>

---------------
addMe.shtml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Add ME!!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

If you want the remotest chance in getting into my files, fill out the form
below and wait for a confirmation email. </p>

As all forms are accurately checked, the wait may be... long....</p>
<form action="post.php" method="POST">


<table width="80%" border="0" cellspacing="0" cellpadding="2">

<script language="javascript">

//IP address display: By http://www.Hostroute.com
//Script featured on JavaScript Kit (http://www.javascriptkit.com)

var ip = ''

function ipval() {
document.myform.ipaddr.value=ip;
}
window.onload=ipval
</script>

Your IP will be logged and submitted. Your IP address is:
<form method="post" action="" name="myform">
<input type="text" name="ipaddr" readonly>
</form>
</p>
(note changing this field will not change the IP address submitted, so no point
in trying :p )
</body>
</html>
---------------
comments.htm
which should be created by the php script and filled out. This said, it doesn''t work and crashes. Error message can be seen by trying:
http://www.doc.ic.ac.uk/~md103/addmeform/contents/addMe.shtml

Thanx,
Spinal


0

Response Number 3
Name: SN
Date: June 6, 2004 at 07:53:18 Pacific
Reply:

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


0

Response Number 4
Name: SN
Date: June 6, 2004 at 07:56:13 Pacific
Reply:

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


0

Response Number 5
Name: Spinal
Date: June 6, 2004 at 08:38:02 Pacific
Reply:

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.txt

I 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


0

Related Posts

See More



Response Number 6
Name: mpawsey
Date: June 6, 2004 at 12:52:25 Pacific
Reply:

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.


0

Response Number 7
Name: Spinal
Date: June 6, 2004 at 13:42:08 Pacific
Reply:

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


0

Response Number 8
Name: safeTsurfa
Date: June 7, 2004 at 01:08:34 Pacific
Reply:

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.



0

Response Number 9
Name: FishMonger
Date: June 7, 2004 at 08:24:58 Pacific
Reply:

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.


0

Response Number 10
Name: FishMonger
Date: June 7, 2004 at 09:09:21 Pacific
Reply:

See if this link helps.

http://www.php.net/manual/en/function.mail.php


0

Response Number 11
Name: Spinal
Date: June 7, 2004 at 10:53:18 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Forms in HTML without mailto:

embed form results in html? www.computing.net/answers/webdevel/embed-form-results-in-html/2800.html

Browse Folder Dialogue box in HTML www.computing.net/answers/webdevel/browse-folder-dialogue-box-in-html-/3237.html

html form www.computing.net/answers/webdevel/html-form/3410.html