...

View Full Version : Need help with website form?



mikehende
11-10-2010, 12:36 AM
Hey guys, I am new here, I have studied XHTML and CSS and will be studying JS next but I am now finishing up my very first site but need a script for a regular "form", can anyone tell me where i might be able to get such a script for free if possible please? The form in question is a simple "Mailing List" form with 6 entries, any help/links/leads will be appreciated.

Old Pedant
11-10-2010, 12:42 AM
Why do you need a script for that? Just a <form> with CSS is all you need.

No scripting needed.

mikehende
11-10-2010, 01:00 AM
I have never used or coded a script before, I am designing a site for someone and this is my very first site so I don't know what is needed to make the form work and searching the net for help I am coming across "Scripting" as the method to making the forms work which is why I went in search of a scripting forum which brought me here.

If I understand you correctly that all I need is CSS coding to make this form work then I will do some more research on the net for this, thanks.

Old Pedant
11-10-2010, 01:10 AM
It depends on what you want to *DO* with the <form>.

If you want to store the answers in a database, you must do that by posting the <form> to server-side processing: PHP or ASP or JSP or whatever.

Even if you just want to email the form contents to somebody, you really can't do that with a script. Yes, it will work for *SOME* people with *SOME* browsers and *SOME* email clients. (The most typical example being MS Internet Explorer used with MS Outlook or Outlook Express.) But your chances of having it work with more than a third to half of all random users is negligible. So you need to submit the <form> to, again, server side processing.

NOW...

What you *might* want to do is use JavaScript to validate the <form> contents: Make sure the person answered all the questions, etc. But what do you do if the user has turned off JavaScript in his/her browser (yes, there still are a lot of paranoid users who do that)?? Kablooey.

So any "validation" you do with JS needs to be re-done with the server-side processing, in any case.

And, finally, do you want to have a "CAPTCHA" question? (That's where you show an image with a word in it and the user must type in the word...it's to prevent robots from spamming your site, of course.) You must do *that* with server-side code, as well.

In short, you can use JavaScript to enhance the user experience. You can't use it as a substitute for *good* forms processing.

mikehende
11-10-2010, 01:35 AM
Well, I haven't covered most of what you're saying yet but tell me this please, I need to have the form's info when filled out to go to the site's owner so she can reply to the person filling out the form, what's the easiest thing I can do to make this work?

Old Pedant
11-10-2010, 01:40 AM
<shrug>Probably just email the form contents to her. Otherwise, she'd have to come to some web page and login to read the messages.

But it depends on how many such forms will be sent to her each day. A handful? Email.
7,321 per day? Ummm...I don't think email is such a hot idea. <grin/>

But as I said, any such solution really needs to be done via server-side coding: PHP, ASP, JSP, etc. Which to use? Depends on what kind of server is hosting her web site.

*MOST* ISP's will provide you with a ready-to-use form mailer. Meaning that all you have to do is write

<form action="formMailer.php" method="post">
(or whatever the URL they give you for the mailer is!)

But beware: Such simple mailers can't be expected to do form validation, let alone handling CAPTCHA if spamming is an issue.

mikehende
11-10-2010, 01:49 AM
The Hosting is with Godaddy.com, what is it I can ask them concerning this form issue please to know what can be done here for the site's owner to receive the info from the form on her page?

Old Pedant
11-10-2010, 01:50 AM
Okay...which kind of hosting? Windows or Linux?

On Windows, I know they give you a form mailer. I *think* they do so on Linux as well.

I'm pretty sure you can find the answer in their FAQs, by the by.

Old Pedant
11-10-2010, 01:54 AM
http://community.godaddy.com/?s=form+mailer

Yep. And instructions for how to use are linked to from that page.

mikehende
11-10-2010, 01:56 AM
Yes, I am holding for them on the phone right now to find out in detail how all of this works.

Old Pedant
11-10-2010, 02:03 AM
Honest, the info on the web site is better than you are likely to get on the phone.

And/or look in their forums.

The only thing you need to know is if the site is hosted on windows or linux.

mikehende
11-10-2010, 02:05 AM
The site is Hosted on Linux. They said I can use either the CGI-Mailer form or Php mailer form, which would be bets here please?

Old Pedant
11-10-2010, 02:15 AM
Just looking at the stuff online, it looks like the PHP version is more flexible. Notice that there are *TWO* PHP mailers.

If it's available to you, use webformmailer.php

http://community.godaddy.com/help/article/510

mikehende
11-10-2010, 02:23 AM
Ok, I will look into all of this in more detail tomorrow and report back here, thank you very much for the help!

mikehende
11-10-2010, 01:14 PM
I am seeing their instructions but I need to ask these questions to learn what I am doing instead of anyone simply telling me what to do so please excuse the questions below and I would appreciate any answers:

On my Index.html file do I have to:

1] Change the existing first line's "Form Action" from :

<form action="http://www.funkadelic.com/contest.php" method="post">

to what they have which is:

<form action="/gdform.php" method="post">

If yes, then why please?

2] If you look at their form entries:

<p>First Name:<input type="text" name="FirstName" /></p>

when mine shows:

<input type="text" name="firstname" value="" />

Their coding look different, can you explain why please or are they both the same thing or is theirs better than mine?

3] Should I include these 2 entries in my form html?

<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />

BTW, this is my entire form coding in my Index.html page:


<form action="http://www.funkadelic.com/contest.php" method="post">
<p>SIGN UP FOR OUR MAILING<br/>
LIST TO RECEIVE DISCOUNT
OFFERS!!</p>

<table id="signUpForm">

<tr>
<td>First Name:</td>
<td>
<input type="text" name="firstname" value="" />
</td>
</tr>
<tr>
<td>Last Name:</td>
<td>
<input type="text" name="lastname" value="" />
</td>
</tr>
<tr>
<td>Band Name:</td>
<td>
<input type="text" name="bandname" value="" />
</td>
</tr>
<tr>
<td>Music Genre:</td>
<td>
<input type="text" name="musicgenre" value="" />
</td>
</tr>
<tr>
<td>Phone: </td>
<td>
<input type="text" name="phone" value="" />
</td>
</tr>
<tr>
<td>Email: </td>
<td>
<input type="text" name="email" value="" />
</td>
</tr>
<tr>
<th></th>
<td>
<input type="submit" value="Submit" />
</td>
</tr>
</table>


</form>

Afro_Programmer
11-10-2010, 05:50 PM
1 -set the path of the form action to whatever page will process YOUR form.

2 -Theirs is the same as yours, except they decided to wrap their input field in p tags for the line breaks.

mikehende
11-10-2010, 06:47 PM
Hey thanks, so if I understand this correctly, since the form mailer is being hosted by Godaddy then I should set the form action to THEIR server which is:

<form action="/gdform.php"

Is this correct?

theatreus
11-10-2010, 08:02 PM
I am seeing their instructions but I need to ask these questions to learn what I am doing instead of anyone simply telling me what to do so please excuse the questions below and I would appreciate any answers:

On my Index.html file do I have to:

1] Change the existing first line's "Form Action" from :

<form action="http://www.funkadelic.com/contest.php" method="post">

to what they have which is:

<form action="/gdform.php" method="post">

If yes, then why please?

2] If you look at their form entries:

<p>First Name:<input type="text" name="FirstName" /></p>

when mine shows:

<input type="text" name="firstname" value="" />

Their coding look different, can you explain why please or are they both the same thing or is theirs better than mine?

3] Should I include these 2 entries in my form html?

<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />

BTW, this is my entire form coding in my Index.html page:

ok yes change your form action so that ull be utilizing there PHP

You will want to do it like this
<p>First Name:<input type="text" name="FirstName" /></p>
but if you wanted to have something already in the box when the page loads then you use value="text here" but if not just leave out value

and as for
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
the first one I would say yes so you know where the msg came from... change the value to whatever you want the subject name to be
the second one only put in if you want them to be redirected to a thank you page after the form is submitted

theatreus
11-10-2010, 08:13 PM
ha... i didnt notice there was a second page... but yeah use there PHP

mikehende
11-10-2010, 09:20 PM
Ok thanks, one last thing I am confused about using the Hosting Company's Form Mailer, if I want to include a "thank you" page after the user fills out the form and hits the Submit button, this means that you will be directed to another webpage with a Thank You note in it, is this correct? If yes, then does this mean I would have to create another html page but with a note that says simply "Thank You"?

Old Pedant
11-10-2010, 09:30 PM
You said the <form> originally had this:

<form action="http://www.funkadelic.com/contest.php" method="post">

So I have no idea what that "contest.php" page does, but if it's appropriate, why not just do

<input type="hidden" name="redirect" value="http://www.funkadelic.com/contest.php" />

???

But why not just *EXPERIMENT*???

It costs nothing. You will likely learn more than we can guess at, since we don't know your exact situtation.

For example, what happens if you *omit* the "redirect" field? I certainly have no idea, but you could find out in a few minutes.

mikehende
11-10-2010, 09:40 PM
I removed the redirect line and the form is now working perfect, when you hit the Submit button the fields empty and the page is refreshed and the site's owner is receiving the info so all's well there, I am only inquiring about the Thank You page just for the knowledge and for any possible future use.

Old Pedant
11-10-2010, 09:42 PM
Yeah, it doesn't have to be a thank you page. You could just redirect the person back to the front page of the site, for example. But you could even redirect them to a completely different site.

mikehende
11-10-2010, 09:48 PM
ok, so what would the coding be if I wish to redirect back to say the Home page? Just simply put "Home Page" like this?

<input type="hidden" name="redirect" value="Home Page.html" />

Old Pedant
11-10-2010, 10:14 PM
I doubt that, very seriously.

What is the *NAME* of the home page???

Normally, it will be "default.html" or "index.html". But it could be "default.php" or "index.php".

Just find the *ACTUAL NAME* of the file that is displayed to the user when he/she enters the URL alone.

To be sure you are correct, *USE* that URL.

For example, one of the sites I work on is
http://www.artsofsnohomish.org

Look at it. But then try the URL
http://www.artsofsnohomish.org/index.asp

Guess what? SAME PAGE!

Every site has a default home page, but to get to it from other pages, you normally use its actual name.

If you really can't figure it out or can't be bothered, then just do


<input type="hidden" name="redirect" value="http://www.theFullSiteName.com" />

Because that *will* automatically find the default page. But if you do that, you must use the full URL, including the "http://" prefix.

mikehende
11-10-2010, 10:52 PM
Oh, the home page file is simply "index.html" and the Nav tab for this page is "Home" so it would be simply:

<input type="hidden" name="redirect" value="index.html" />

is this correct?

Old Pedant
11-10-2010, 11:34 PM
Why not just test it???

If it's correct, it will work. If not, it won't. There's not much middle ground.

I would *assume* it is correct, yet, but I don't have the site in front of me, so I can't assert that at fact.

james720
11-11-2010, 12:46 PM
Why do you need a script for that? Just a <form> with CSS is all you need.

No scripting needed.

Old Pedant
11-11-2010, 08:21 PM
Why do you need a script for that? Just a <form> with CSS is all you need.

No scripting needed.

This must be the weirdest SPAM yet. That's a direct quote of my first reply in this thread.

Normally, this kind of SPAM is accompanied by some sort of advertisement, but there's not even that, with this post.

Totally pointless.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum