PDA

View Full Version : Contact Form Confirmation Page - Help!


macsolutions
01-31-2008, 07:58 AM
I am using DW CS3 to make a contact form using the tutorial at http://www.dreamweaverclub.com/dreamweaver-php-form.php (http://www.dreamweaverclub.com/forum/../dreamweaver-php-form.php)

Does this mean that when you submit the form, a confirmation page is displayed to the sender, or do I have to make the confirmation page myself and if so how do I do this.

I dont know if it makes any difference but the account which the domain is residing at has PHP without a database? What are my limitations for having PHP and no database.

All help would be much appreciated.
Thanks
Tom

lux
01-31-2008, 09:01 AM
In the sendresults.php page there are these two lines of code:


// Where to redirect after form is processed.
$url = 'http://www.rdsnetworks.net/confirmation.html';


change the URL to a new page that you have created which displays a message to the user to say their email has been sent.

As for your second question. Without a database you will not be able to store information. Whether you need a database to work with PHP really depends on what you want to develop.

If you want to build a login in system for private members to add content to your website for instance the you would need a database.

I would say work out what it is you want to develop then assess whether or not you need to purchase a MySQL database for instance.

macsolutions
01-31-2008, 09:23 AM
Thanks, Is a confirmation page a normal html page made up in DW.
I am only using PHP for this contact page, so I suppose I would not need a database for this?

lux
01-31-2008, 11:30 AM
Your right. The confirmation page can be an html page created in DW.

No database required

macsolutions
01-31-2008, 02:36 PM
Could someone help me finish off my website with this form.

I have made all the pages required.

1. My script page is sendresults.php - What application do I save this file in?
2. My script is for a contact page allowing people to send email to me but all I get in my email is ( Results from form: ) and nothing else.
3. I also get the following message in the browser window when I click the submit button on my contact page:
Method Not Allowed

The requested method POST is not allowed for the URL /Contact Us/Contact Us.html.

4. My web pages are in DW CS3 on Mac

5. My confirmation pages reside at /Confirmation/confirmation.html

6. My contact pages reside at /Confirmation/confirmation.html

HTML FORM CODE

<table width="380" cellspacing="2">
<tr>
<th width="63" align="right" valign="top" scope="row"><label for="CustomerName" class="style4">Name:</label></th>
<td width="425"><form action="www.macsolutions.co.uk/sendresults.php" method="post" name="Contact form" target="_self" id="Contact form">
<input name="CustomerName" type="text" id="CustomerName" size="25" maxlength="50" />
</form> </td>
</tr>
<tr>
<th align="right" valign="top" scope="row"><label for="CompanyName" class="style4">Company:</label></th>
<td><form id="form2" name="form2" method="post" action="">
<input name="CompanyName" type="text" id="CompanyName" size="25" maxlength="50" />
</form> </td>
</tr>
<tr>
<th align="right" valign="top" scope="row"><label for="EmailAddress" class="style4">Email:</label></th>
<td><form id="form3" name="form3" method="post" action="">
<input name="EmailAddress" type="text" id="EmailAddress" size="25" maxlength="50" />
</form> </td>
</tr>
<tr>
<th align="right" valign="top" scope="row"><label for="CommentsBox" class="style4">Comments:</label></th>
<td><form id="form4" name="form4" method="post" action="">
<textarea name="CommentsBox" id="CommentsBox" cols="35" rows="4"></textarea>
</form> </td>
</tr>
<tr>
<th align="right" valign="top" scope="row">&nbsp;</th>
<td><form id="form5" name="form5" method="post" action="">
<input type="submit" name="button" id="button" value="Submit Form" />
</form>
</td>
</tr>
</table>


PHP SCRIPT

<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Contact form enquirie';

// Your email address. This is where the form information will be sent.
$emailadd = 'support@macsolutions.co.uk';

// Where to redirect after form is processed.
$url = 'http://www.macsolutions.co.uk/../Confirmation/confirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>


*** code tags please when posting code - dj ***