View Full Version : Which method is best for a dynamic page?
leet8845
12-21-2006, 12:48 AM
Hi all,
This is my first post here and I'm gonna ask lots of questions and hope someone is kind enough to help me:)
I have built a website in HTML and have set it up on the net through a host. I used a web based system 'HELM' and Dreamweaver to connect to the remote folder with ftp to up load files etc. Everthing works apart from I want to add a comment form so users can submit messages.The form will have four fields NAME,EMAIL... etc. I want the messages to go the email account which is with my host server.I understand to do this I need to use a dynamic page this im unfamailiar with. 2 people have tried to help me by sending me ASP and PHP pages and files but i cant get either to work.
I need to understand from step one so i can do it myself and see where im going wrong.
Which method is best ASP.NET,ASP,PHP or any other?
or should I say which is simiplist?
Do i have to setup a test server on my PC inorder to create the form?
Any help would truly appreciated
phpnewb
12-21-2006, 03:44 AM
i think you do need to setup a test server to test your script.
CFMaBiSmAd
12-21-2006, 04:00 AM
The first step would be to pick a server side language (PHP, ASP, ASP.NET) that is supported by your hosting package. Since you mention you have a Helm control panel, this is would likely be ASP and/or ASP.NET, but PHP could be supported as well. Once you identify which server side languages are supported (perhaps none are if this is a free/basic package) you can then concentrate on a specific script using that language.
leet8845
12-21-2006, 04:17 AM
The first step would be to pick a server side language (PHP, ASP, ASP.NET) that is supported by your hosting package. Since you mention you have a Helm control panel, this is would likely be ASP and/or ASP.NET, but PHP could be supported as well. Once you identify which server side languages are supported (perhaps none are if this is a free/basic package) you can then concentrate on a specific script using that language.
hi,
thanks for your reply.
It supports all of them,I checked in the settings on helm.Its not a basic package you see. which is the simplist to setup?
I have set up a form in html and asp they work in the browser but the point im stuck at is how to get the info submitted from that form to the server and then in my to my email acc(located on that server).
Must i use a dynamic page or is it possible to just use the POST method and what do I put in the action box if this the case?
Again thankyou for lookin
CFMaBiSmAd
12-21-2006, 04:45 AM
In the end, the form page you have created will reside on the web server, so that it is accessible to anyone browsing to it.
When a form is submitted, the browser requests the URL formed from the action = "...." parameter in the form and sends the POST/GET data for the form fields. The form processing code on the server receives the POST/GET data and does whatever you want with it, including setting up an email and sending it.
To learn the specific actions that the form processing code needs to do, examine existing scripts -
ASP - http://www.hotscripts.com/ASP/Scripts_and_Components/Form_Processors/index.html
PHP - http://www.hotscripts.com/PHP/Scripts_and_Programs/Form_Processors/index.html
leet8845
12-21-2006, 04:58 AM
In the end, the form page you have created will reside on the web server, so that it is accessible to anyone browsing to it.
When a form is submitted, the browser requests the URL formed from the action = "...." parameter in the form and sends the POST/GET data for the form fields. The form processing code on the server receives the POST/GET data and does whatever you want with it, including setting up an email and sending it.
To learn the specific actions that the form processing code needs to do, examine existing scripts -
ASP - http://www.hotscripts.com/ASP/Scripts_and_Components/Form_Processors/index.html
PHP - http://www.hotscripts.com/PHP/Scripts_and_Programs/Form_Processors/index.html
Thanks.
So on the HTML contact form i have built, i could type the url of my web site in action field and then it will go to server or must i do the whole form in either ASP or PHP?
CFMaBiSmAd
12-21-2006, 05:18 AM
Yes, if you have a HTML form, just setting the action = parameter is all that you need to do.
You would create a dynamically built form using PHP/ASP... if you were populating it with fields/lists... that are driven by a database...
karlosio
12-29-2006, 07:45 PM
Heres a simple PHP script that would send email, it will also do it on the same page using <?php echo htmlspecialchars($_SERVER['PHP_SELF']);?> for the form action, it sets up a conditional region so that if the form has been submitted it will then display the thank you message instead of the form.
Hope this helps, ive commented it to try and help give you an idea on how it works.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
// if submit button has not been pressed output the form
if (!isset($_POST['submit'])) {
?>
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" method="post">
<table width="600" cellpadding="5" cellspacing="0" border="0">
<tr>
<td>Name:</td>
<td><input type="text" name="name" value="<?php echo $_POST['name'];?>" /></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="uemail" value="<?php echo $_POST['uemail'];?>" /></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="Send" /></td>
</tr>
</table>
</form>
<?php }
else { //otherwise if submit has been pressed setup variables, email form and display message
$email = "youremail@domain.com"; //your email address
$subject = "Someones filled out your form"; //message in subject
$name = $_POST['name']; //name form field
$uemail = $_POST['uemail']; //email address form field
//mail the form using email address and subject variables
mail("$email","$subject",
//emails content
"
Name: $name \n
Email address: \n
");?>
<p><strong>Thank you <?php echo $name; //echos name of person who submitted form ?> for filling out my form!</strong></p>
<?php
} // end else
?>
</body>
</html>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.