Reply LinkBack Thread Tools Search this Thread
Old 20-02-2007, 10:40   #1 (permalink)
Newbie123
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.
  Reply With Quote
Old 20-02-2007, 10:45   #2 (permalink)
funkyprem
For all your goober needs
 
funkyprem's Avatar
 
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
  Reply With Quote
Old 20-02-2007, 11:17   #3 (permalink)
centro
 
Join Date: May 2004
Posts: 1,609
Quote:
Originally Posted by Newbie123
Hi there,

I posted this in my original 'please be gentle' thread but no-one has replied


Thats gentle.
  Reply With Quote
Old 20-02-2007, 11:28   #4 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
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>
__________________
  Reply With Quote
Old 20-02-2007, 11:30   #5 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Quote:
Originally Posted by Newbie123
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.
Your best bet overall is probably going to be a Linux server (OS), running Apache (web server), using PHP (app server...kinda...it's just an engine that executes PHP programming).

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:
<?php echo "Hello!"; ?>
Save it, upload it, and call it in your browser (yoursite.co.uk/hello.php, for example). You should see "Hello!". If that doesn't work, get in touch with your host.

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.
  Reply With Quote
Old 20-02-2007, 12:02   #6 (permalink)
Newbie123
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:
Originally Posted by centro
Thats gentle.

Is that sarcasm or just humour?
  Reply With Quote
Old 20-02-2007, 12:14   #7 (permalink)
funkyprem
For all your goober needs
 
funkyprem's Avatar
 
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
  Reply With Quote
Old 20-02-2007, 12:24   #8 (permalink)
Newbie123
Registered User
 
Join Date: Feb 2007
Posts: 30
Oh...o.k. my misunderstanding, sorry. So a PHP script is the best way I guess. So much to learn! Thanks for your patience.
  Reply With Quote
Old 20-02-2007, 12:59   #9 (permalink)
Newbie123
Registered User
 
Join Date: Feb 2007
Posts: 30
Quote:
Originally Posted by funkyprem
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.

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.
  Reply With Quote
Old 20-02-2007, 13:26   #10 (permalink)
pagey
Resident Cheese Expert
 
pagey's Avatar
 
Join Date: Aug 2006
Location: South Wales
Posts: 812
Quote:
Originally Posted by Newbie123
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.

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.
  Reply With Quote
Old 20-02-2007, 13:37   #11 (permalink)
mike_m
Work faster microphone ..
 
mike_m's Avatar
 
Join Date: Feb 2003
Location: Cambridge, UK
Posts: 1,709
Download this: http://www.php-form.net/ follow thier instructions. Sorted.
__________________
  Reply With Quote
Old 20-02-2007, 17:54   #12 (permalink)
Newbie123
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.
  Reply With Quote
Old 20-02-2007, 20:31   #13 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,996
katebullock.co.uk/1mnmusic.php

This link (with www added) is not working for me?
__________________
  Reply With Quote
Old 21-02-2007, 03:52   #14 (permalink)
Newbie123
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.
  Reply With Quote
Old 21-02-2007, 17:07   #15 (permalink)
Newbie123
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
  Reply With Quote
Old 21-02-2007, 17:11   #16 (permalink)
Newbie123
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
}

?>
  Reply With Quote
Old 21-02-2007, 17:12   #17 (permalink)
Newbie123
Registered User
 
Join Date: Feb 2007
Posts: 30
When I try and submit, it just returns the error 'uh-oh! looks like you've missed a required field. Please, try again'. Does that mean that there's an error in the preceding part of the code?
  Reply With Quote
Old 21-02-2007, 17:27   #18 (permalink)
Newbie123
Registered User
 
Join Date: Feb 2007
Posts: 30
Oh boy,
What a wally. I think I may have found out what I'm doing wrong here...back in a while to confirm this.
  Reply With Quote
Old 21-02-2007, 17:44   #19 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Under "$message = $_POST['message'];" try adding "$math = $_POST['math'];"

Sorry, my mistake! I'll fix it when I get home.

FYI, the includes and the $thisPage and $pageTitle can be removed.
  Reply With Quote
Old 21-02-2007, 18:11   #20 (permalink)
Newbie123
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.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8