FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

How do I send a webform?

 


Editorinchief
So I used quarkXpress and put together a simple webform with buttons and drop down menus and such. I also added a submit button. I then converted to html and put it all online. I haven't figured out how to get the form to go anywhere though or do anything but simply be an empty form people can type on but not send anywhere.

When people press submit, I was wondering how I get that form to be emailed to a web address. Right now, the submit button does nothing.

I'm a total noob with web design, but doing it myself anyways. Can someone help me? And get Frih points for doing so? Thanks. I'll make sure I check this post continuously and I'll put an email alert on any responses.
hexkid
Editorinchief wrote:
[...] I haven't figured out how to get the form to go anywhere

The form "goes" to the URL specified in its action attribute.
Code:
<form action="http://www.example.com/submittal">
<input ...>
<input type="submit">
</form>
This form goes to example.com/submittal

Editorinchief wrote:
[...]
When people press submit, I was wondering how I get that form to be emailed to a web address.

The URL where the form gets submitted to must be a program or script that processes the input data and mails it. This program/script can be done in a great many ways (PHP, Perl, C, C++, Shell Script, Batch File(???), ..., ...).
Here's a quick PHP example:
Code:
<?php
$body = print_r($_POST, true);
mail('your@address.com', 'form submitted', $body);
echo 'Thank you for submitting the information. It is being processed and you will soon be contacted.';
?>


Editorinchief wrote:
[...]
Can someone help me? And get Frih points for doing so? [...]

Hope this helps. Save your Frih points.
Editorinchief
so basically, save that PHP code as a URL in my webpage index. so .. example.com/submitcode.html

Then change the form action to send the form to example.com/submitcode.html

Then just customize the php code - put in the proper email.


Questions:

Does that particular PHP code just include all form information, and email it to me - including radio button selections, drop down menu selections... ect... or just Body text written in my textboxes?

Does the submit button that I made with Quark, make an HTML section similar to what you gave as an example in the first piece of code in your reply? Or must I insert this html somewhere? If so, where should I insert it?



Thanks for the reply... hopefully I got what you meant, as evidenced by my reply. If so, I thank you for the simple reply that got to the point well.
hexkid
Editorinchief wrote:
so basically, save that PHP code as a URL in my webpage index. so .. example.com/submitcode.html

Yes ... well, almost Smile
Most servers aren't set up to use PHP on files ending in html. You might need to save it as example.com/submitcode.php
If you choose a "real program" (as opposed to a script), you probably need to put that program in a cgi-bin directory and change the action accordingly: <form action="example.com/cgi-bin/submitcode.exe" ...>

Editorinchief wrote:
Then change the form action to send the form to example.com/submitcode.html

submitcode.php -- the action must match the existing script.
You might want to make sure the form method is POST too. If you don't specify a method, GET is used by default.
Code:
<form action="submitcode.php" method="post">
<!-- ... -->
</form>


Editorinchief wrote:
Then just customize the php code - put in the proper email.

Right! It should work as posted.

Editorinchief wrote:
Does that particular PHP code just include all form information, and email it to me - including radio button selections, drop down menu selections... ect... or just Body text written in my textboxes?

It mails all the form information, according to the rules of form submittal.

For example, this form
Code:
<form action="x.php" method="post">
Name: <input type="text" name="name"><br>
Age: <input type="text" name="age"><br>
Gender: <input type="radio" id="r_female" name="gender" value="female"><label for="r_female">Female</label>&nbsp; &nbsp;<input type="radio" id="r_male" name="gender" value="male"><label for="r_male">Male</label><br>
Comments: <textarea name="comments" rows="8" cols="50"></textarea><br>
<input type="submit" value="Send">
</form>
could create a message just like
Code:
Array
(
    [name] => hexkid
    [age] => 777
    [comments] => No comments at this time.

This is line 3 of the textarea.
)
Notice you didn't get a [gender] in the message. That means the "gender" control wasn't succesfull (bad design!).

Editorinchief wrote:
Does the submit button that I made with Quark, make an HTML section similar to what you gave as an example in the first piece of code in your reply? Or must I insert this html somewhere? If so, where should I insert it?

I suppose so, but having never worked with Quark, I don't really know. But HTML is HTML no matter what application you used to create it.

So you'll need two files: one with the HTML <form> (the one Quark generated) and another to process the data and mail it to you (just copy/paste/edit my example and save it as specified in the form action). Some people like to make it all one single page that both asks for the info and mails it. For beginners I think this is easier Smile


Editorinchief wrote:
Thanks for the reply... hopefully I got what you meant, as evidenced by my reply. If so, I thank you for the simple reply that got to the point well.

I think you did. Thank you for the feedback.
bboy_nycb
Why not use the module CGI in Perl?

http://search.cpan.org/~lds/CGI.pm-3.20/CGI.pm
Editorinchief
bboy_nycb wrote:
Why not use the module CGI in Perl?

http://search.cpan.org/~lds/CGI.pm-3.20/CGI.pm


Because I have absolutely no idea what any of that garbage is that you just posted at that link. Wink
niranvv
CheckOut this:
Forms To Go software!!
It will help u to send form datas in a well formated manner to your mail box!
( No programming skill is needed)
Just put the php page generated by this software in ur website and link that file in ur <form action=""...> field!!
here it is:
http://www.frihost.com/forums/vt-21009.html

Love
Niran
www.niran.frih.net
Dancing
jayandsilo
this is an easy free perl form for noobs

http://codebrain.com/perl/alphamail/index.html

I can set it up if you want. Just PM me.
Related topics

Send the Bill to My&#12288;Father
Gmail?
Can't enter my Gmail Account! Help and I send you invatation
I have 6 point, why did you send me ...
30Gb of e-mail space. Insane

Mail with PHP (Simple Tutorial)
jyoko@habbotouch.com Can Send, but not Receive..?
send your linux screenshot :)
Send Mail HTML Form
send and receive point

Unable to send email to *@msn.com addresses
zip a file and send to user
What is a good website to send free SMS messages?
Send me 15 FRIH$....
ern money online, how
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.