| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Registered User
Join Date: Feb 2007
Posts: 30
|
still struggling to understand this...
Hi there, I posted this in my original 'please be gentle' thread but no-one has replied - thought I'd try resubmitting. Basically I want to put a simple HTML form onto my website (katebullock.co.uk) for people to fill in. I understand that I need a web server and an application server in order to process the resulting data. Other than that I'm really struggling to find the information I need quickly enough to make some headway. Which application server should I choose (bearing in mind I'm new to all this) and does anyone have any suggestions as to how to set this up, as simply as possible? Thanks in advance. |
|
|
|
|
|
#2 (permalink) |
|
For all your goober needs
Join Date: Dec 2004
Location: Coventry, UK
Posts: 1,531
|
i don't know what you mean by application server, but you'll first need to find out what operating system your site runs on. by this I mean is it windows, linux or apache. if it's linux or apache, you then need to find out if PHP is enabled on your account (it usually is) then find some PHP tutorials on how to process forms and form data. If it's a windows account you have, you'll need an ASP tutorial. ASP and PHP are whats called server side languages. Time is really the only capital that any human being has, and the one thing that he can’t afford to lose. - Thomas Edison
prem ghinde |
|
|
|
#4 (permalink) |
|
Spare Parts
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,996
|
<cotton wool> You need a form for the visitor to fill in. When they press submit the data is sent to a script (PHP) which puts the data into an email and sends it. This is the first I came to doing a google search http://www.ibdhost.com/contact/ </cotton wool> |
|
|
|
#5 (permalink) | |
|
Senior Member
Join Date: Jan 2005
Posts: 12,340
|
Quote:
This is a "LAMP" server - Linux, Apache, MySQL, PHP (MySQL being the database) - and it's the most common form of web server, I believe. All four of those applications are free and open-source. Your host seems to be streamline.net and according to http://streamline.net/wh.php they support PHP4. That's what you'll use. To test it, create an empty file in Notepad called hello.php, open it and paste in: Code:
HTML is just a markup language, so it can't "do" anything. For that, you need something to process the form inputs. Something like PHP. You can use my PHP contact form script if you like. Or Google it. There's a million of them out there floating around. |
|
|
|
|
#6 (permalink) | |
|
Registered User
Join Date: Feb 2007
Posts: 30
|
Thanks guys, that's a great help. I'm looking at the possibilities of Javascript also - would that work? I'll check out doing it the PHP way. By the way... Quote:
Is that sarcasm or just humour? |
|
|
|
|
#7 (permalink) |
|
For all your goober needs
Join Date: Dec 2004
Location: Coventry, UK
Posts: 1,531
|
javascript to process form data? no. Time is really the only capital that any human being has, and the one thing that he can’t afford to lose. - Thomas Edison
prem ghinde |
|
|
|
#9 (permalink) | |
|
Registered User
Join Date: Feb 2007
Posts: 30
|
Quote:
My account is on a Windows server. PHP is enabled, - but can I use PHP? From what you say above I need to use ASP. |
|
|
|
|
#10 (permalink) | |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 812
|
Quote:
ASP (or ASP.Net) is kind of the Windows equivalent to PHP. The main difference is that PHP is open-source (free!). Also, you can use PHP on a Windows machine/server, as long as your server has it enabled (which yours appears to have). Therefore, there wouldn't appear to be anything standing in your way, apart from learning some PHP, to sort your form out. |
|
|
|
|
#11 (permalink) |
|
Work faster microphone ..
Join Date: Feb 2003
Location: Cambridge, UK
Posts: 1,709
|
Download this: http://www.php-form.net/ follow thier instructions. Sorted. |
|
|
|
#12 (permalink) |
|
Registered User
Join Date: Feb 2007
Posts: 30
|
Thanks again everyone. Quick note to pgo, Thanks v much for your advice - I wanted to try your php script (thanks for offering it to me) - I've put it on my site (katebullock.co.uk/1mnmusic.php) - and each time I fill in the boxes it returns the error 'uh-oh, looks like you've missed a required field, please try again'. I guess that's something to do with me not altering the code correctly for my needs. I have put my email address as the 'mail to', and entered valid form data, but I can't get anywhere with it. If you could spare me a moment, I'd love to know if you think it's a simple thing to sort! Thanks again for the offer of your script. |
|
|
|
#14 (permalink) |
|
Registered User
Join Date: Feb 2007
Posts: 30
|
No, it's not working for me now either. I'm at work all day so no chance to rectify this...I was working on it late last night and gave up - must have done something very wrong. Oh well - I'll perservere, it will have to be later on this evening. |
|
|
|
#15 (permalink) |
|
Registered User
Join Date: Feb 2007
Posts: 30
|
Hi, I'm still struggling away with this one. Both links (one with modified code = katebullock.co.uk/1minmusic.php, and one with unaltered code as per pgo's php form = katebullock.co.uk/1mnmusic.php) both have the same problem. I don't know what I've done, or whether you'll be able to access them - I guess I'm taking lots of 'shots in the dark' to figure it out but I'm getting nowhere. I'm scared of using a php script that makes me accessible to dangers like spambots, and pgo's form looks great for that, but I don't know how to configure it. Sorry about all this - would really appreciate your help if poss! Thanks |
|
|
|
#16 (permalink) |
|
Registered User
Join Date: Feb 2007
Posts: 30
|
I guess it might help to post the code I've modified (probably a complete shambles) as opposed to the code very kindly offered by pgo: <?php $thisPage = "1minmusic"; $pageTitle = "1 min music request form"; $to="klb@allsearchengines.co.uk"; $showForm=true; if (!isset($_POST["submit"])){ echo "\n <p>Please feel free to use the form below to send me an email. I promise I'll respond as soon as I'm able.</p>"; } else { $name = $_POST['name']; $name = urldecode($name); $email = $_POST['email']; $url = $_POST['url']; $message = $_POST['message']; $subject = "1 min music form"; $headers = "From: $name \n"; $headers .= "Reply-To: $email"; if (!empty($math)) { if ($math != '15') { $math = strtolower($math); } } if (empty($name) || empty($email) || empty($message) || empty($math)) { echo "\n <h3>Error!</h3>"; echo "\n <p>Uh oh! Looks like you missed one of the required fields. Please, try again.</p>"; } elseif ($math != '15' && $math != 'fifteen') { echo "\n <h3>Check Your Math</h3>"; echo "\n <p>You didn't answer the math question correctly. It's not hard...unless you're a spambot.</p>"; } elseif (eregi("\r",$name) || eregi("\n",$name) || eregi("\r",$email) || eregi("\n",$email) || eregi("\r",$url) || eregi("\n",$url)) { echo "\n <h3>Error!</h3>"; echo "\n <p>Tsk, tsk! Seems as though you're trying to inject some email headers. That's not very nice.</p>"; } elseif (!eregi('^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\w]*[0-9a-zA-Z])*\.)+[a-zA-Z]{2,9})$', $email) ) { echo "\n <h3>Error!</h3>"; echo "\n <p>Strange. It seems you've entered an invalid email address. Please, try again and check for typos!</p>"; } else { $full_message = "$message\n\nFrom: $name\nEmail: $email\nURL: $url"; mail ($to, $subject, $full_message, $headers); echo "\n <h3>Success!</h3>"; echo "\n <p>Your email was successfully sent!</p>"; echo "\n <p>I will respond to your message as soon as possible. Thank you for your interest in me and my work.</p>"; $showForm = false; } } if ($showForm) { ?> <form id="1minmusicForm" method="POST" action="<?=$_SERVER['PHP_SELF'];?>"> <div class="clearfix"> <label for="name">Name <span>(<abbr title="Required">Req'd</abbr>)</span></label> <input type="text" name="name" id="name" class="text" value="<?php echo $name; ?>" /> </div> <div class="clearfix"> <label for="email">Email <span>(<abbr title="Required">Req'd</abbr>)</span></label> <input type="text" name="email" id="email" class="text" value="<?php echo $email; ?>" /> </div> <div class="clearfix"> <label for="url">Website </label> <input type="text" name="url" id="url" class="text" value="<?php echo $url; ?>" /> </div> <div class="clearfix"> <label for="message">Message <span>(<abbr title="Required">Req'd</abbr>)</span></label> <textarea rows="10" cols="30" name="message" id="message"></textarea> </div> <p>Please answer the following math question. This is to prevent spam bots from automatically filling out this form.</p> <div class="clearfix"> <label for="math">What is five times the square root of 9? <span>(<abbr title="Required">Req'd</abbr>)</span></label> <input type="text" name="math" id="math" class="text" value="" /> </div> <div><input type="submit" name="submit" value="Send" id="send" class="button" /></div> </form> <?php } ?> |
|
|
|
#20 (permalink) |
|
Registered User
Join Date: Feb 2007
Posts: 30
|
Hey pgo, No worries - Thanks for fixing the problem. But I've sent it to my email, and it hasn't arrived. Do you think it's something to do with my server (streamline.net) - is there anything I could do to check if so? thanks. |
|
![]() |