Jump to content
xisto Community
Sign in to follow this  
pokerforce

Creating Forms? :s? Help!

Recommended Posts

Hi seeing as i SUCK at web building i need help.ok what i'm trying to do is, if i press a link, a new small window will show up in which there is a formIn the form you have to enter the following detailsFirstName:Last Name:Account Number: (starting with RVRP)Date Deposited (format MM/DD/YYYY)Date Completed (format MM/DD/YYYY)Email Address:Amazon: (choice between Amazon.com , Amazon.ca , Amazon.co.uk) drop down menu would be good for this.and a submit button which will send the details to my email.once its done, a "warning" type window should show up saying "Thank you for Registering, We will get back to you within 72 hours"furthermore, if any of the field is not written in, the form would appear again saying which field hasn't been filled in etc, and if the format is wrong (ie the date, the same will happen..)how do i make such a thing? i know it's supposed to be easy but my head is hard as a rock..

Share this post


Link to post
Share on other sites

You can't do it with just HTML, you need something for the mail sending. Well actually you can do it, but its real clumsy and awful method.

The form itself is easy to do, just plain HTML.

It could look something like this:

<form action="[mailing script]" method="post"><label for="firstname">First name</label><input type="text" id="firstname" name="firstname"/>(and so on..)
<input type="submit" value="Send"/>
</form>

[/code]

<label>s are a modern and stylish way to do this, and to make them look good you need to do some CSS. Other way, the typical one, is to build a table with the form elements inside the cells.

For the dates and the amazon thing you could use select elements:

<select name="amazon"><option value="com">Amazon.com</option><option value="de">Amazon.de</option>and so on</select>



So far pretty straight forward. Next you need to do some programming.
[/code]
You need to have a program in the server to send the mail. Probably easiest way to do it is PHP.

Basically all you need to send email in PHP is to call function called mail(). As parameters it takes email address (where the message is to be sent), subject, the message itself and headers.

You can access the data from the form with $_POST['variable'], provided that you used post as method instead of get. For mailing, post is recommended.

Before calling mail, you need to do some processing with your data. You can do checks wether the fields are filled correctly and so on. Then you need to compile the information into the message format. I'd also recommend adding some headers to make the mail a little neater and easier for the recipient (ie. you) to reply.

The very basic script could look something like this:



<?php$message = 'Firstname: '.$_POST['firstname']. "\n"..'Lastname: '.$_POST['lastname']."\n";and so on...$headers = "Reply-To: ". $_POST['email']."\n";$headers .= "X-Mailer: PHP/" . phpversion();mail('your@email.com', 'Subject', $message, $headers);?>


You can of course format the message in anyways you see best, even use HTML if you like HTML mail. For the header, you can do lot of things, if your interested google or visit php.net.

The above script should work, but its recommeded to at least check that the mailing works and then print out a message for the user. Mail returns true if the message was sent, false if not.

So to check and print the message:

if ( mail( ----stuff inside----) ){[tab][/tab]echo "Mail was sent";}else{[tab][/tab]echo "Mail was not sent";};


Hopefully this helped to get you started.

Share this post


Link to post
Share on other sites

I just noticed that you are not yet a hosted member, and I looked over the requirements of your form, which would work weel with PHP or Perl (I prefer PHP) but when you get a hosting account with Xisto there is a cgiecho in the cgi-bin and there is also a cgimail from Matts Archive Scripts, there is a link in the C Panel to let you know how to set up the fields in your form and just for the heck of it I am playing with it, and also some other Perl scripts from Big Nose Bird that handles emails with TLDs of four charachters like .info or .name.

 

You would use the cgiecho to test out your form and then view the results on your browser. Writing your script is not that difficult since it is just an HTML form and if necessary you can use JavaScript to force completion of fields even before submission (an alert tell them the form and what fields have not been filled out), but validation is not the same as verification, so a bogus email would only be verified by requiring a to get a carbon copy of the email and have a receipt requested, so you are getting into deep water there.

 

If you would like to see what I have come up with that at least meets the form requirements then PM me.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.