Jump to content

Help with PHP form for website please ?


Melissafleet

Recommended Posts

:'(

 

Hi

 

PLease can someone perhaps assist me with the following? (perhaps if you could even respond to only one item on the below, I would be most grateful please:?

 

Thank you

 

 

I have created a php form (which i inserted into wordpress site)

www.lookinside.co.za/wp

- under "Conferences" tab...

 

This form is working well, I just have a couple of changes which I would like to make, and am not sure how.

if someone could perhaps maybe even help with one of the items on here I would be extremely grateful please :-)

 

Changes:

 

1. is it possible to have a "print" button to appear on the page that comes up after submitting the quote?

2. Can we insert a "date" field possibly with a calendar popup to select a date for the conference?

3. Can images and other text appear on the "after submission" page? that will then also print, ie: info about the conference rooms, images?

4. Can the no. of people calculate as the number is entered? not seem to be working...

5. when the submitted form is emailed through / and viewed, is it possible to include the title of the duration? ie at the moment it shows as: "Duration: R200", can we make it "Duration: Full Day - R200" or something? THe same for the "menu selection"

 

 

<?php if(isset($_POST['action']) && $_POST['action'] == "submit_post"): ?> 

<?php 
    $string = "Customer Name: ". $_POST['name']. "\n"; 
    $string .= "Company: ". $_POST['company']. "\n"; 
    $string .= "Conference Name: ". $_POST['field-36b58f8c5142ff3']. "\n"; 
    $string .= "Telephone Number: ". $_POST['field-7c496d0fb21abfd']. "\n"; 
    $string .= "Duration: ". $_POST['field-385963a5c9a4ef9']. "\n"; 
    $string .= "Number of People: ". $_POST['field-5af722f60ee2f9b']. "\n"; 
    $string .= "Menu: ". $_POST['menu']. "\n"; 
    $string .= "Overhead Projector: ". $_POST['field-73cf21adf8b52d5']. "\n"; 
    $string .= "Email: ". $_POST['field-3f92f5a7876cd50']. "\n"; 
    $string .= "Sub Total: ". $_POST['totalcost']. "\n"; 

    print "<p>". nl2br($string) ."</p>"; 

    $to = $_POST['field-3f92f5a7876cd50'] . ", "; //This is the users email address 
    $to .= "melissafleetwood@yahoo.com" . ", "; //Put your first email here 
    $to .= "melissa@run-time.co.za"; //Put your second email here 

    $subject = "Reciept confirmation"; 
    $headers = "From: melissa@lookinside.co.za"; 

    mail($to, $subject, $string, $headers); 
?> 

<?php else: ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 
<head> 
<title>Contact Form Test</title> 
</head> 
<body> 
<form action="" method="post"> 
<div> 
<input type="hidden" name="action" id="acctid" value="submit_post" /> 
</div> 
<table cellspacing="5" cellpadding="5" border="0"> 
<td valign="top"> 
<strong>Name of Contact Person:</strong> 
</td> 
<td valign="top"> 
<input type="text" name="name" id="name" size="40" value="" /> 
</td> 
</tr> 
<tr> 
<td valign="top"> 
<strong>Company:</strong> 
</td> 
<td valign="top"> 
<input type="text" name="company" id="company" size="40" value="" /> 

</td> 
</tr> 
<tr> 
<td valign="top"> 
<strong>Official Name Of Conference</strong> 
</td> 
<td valign="top"> 
<input type="text" name="field-36b58f8c5142ff3" id="field-36b58f8c5142ff3" size="40" value="" /> 

</td> 
</tr> 
<tr> 
<td valign="top"> 
<strong>Tel No Of Contact Person:</strong> 
</td> 
<td valign="top"> 
<input type="text" name="field-7c496d0fb21abfd" id="field-7c496d0fb21abfd" size="40" value="" /> 

</td> 
</tr> 
<tr> 
<td valign="top"> 
<strong>Duration:</strong> 
</td> 
<td valign="top"> 
<input type="radio" name="field-385963a5c9a4ef9" id="game4" value="220.00" onclick="UpdateCost()"> Full Day R220.00<br/> 
<input type="radio" name="field-385963a5c9a4ef9" id="game5" value="200.00" onclick="UpdateCost()"> Half Day R200.00<br/> 

</td> 
</tr> 
<tr> 
<td valign="top"> 
<strong>No Of People</strong> 
</td> 
<td valign="top"> 
<input type="text" name="field-5af722f60ee2f9b" id="field-5af722f60ee2f9b" size="40" value="" onchange="UpdateCost()"/> 

</td> 
</tr> 
<tr> 
<td valign="top"> 
<strong>Please select a menu:</strong> 
</td> 

<td valign="top"> 
<input type="radio" name="menu" id='game0' value="60.00" onclick="UpdateCost()">Menu A (60.00)<br> 
<input type="radio" name="menu" id='game1' value="90.00" onclick="UpdateCost()">Menu B (90.00)<br> 
<input type="radio" name="menu" id='game2' value="120.00" onclick="UpdateCost()">Menu C (120.00)<br> 
<input type="radio" name="menu" id='game3' value="150.00" onclick="UpdateCost()">Braai/Barbeque (150.00)<br> 

</td> 
</tr> 
<tr> 
<td valign="top"> 
<strong>Overhead Projector</strong> 
</td> 
<td valign="top"> 
<input type="checkbox" name="field-73cf21adf8b52d5" id="game6" value="650.00" onclick="UpdateCost()">R650.00 <br/> 

</td> 
</tr> 
<tr> 
<td valign="top"> 
<strong>Email of Contact Person: </strong> 
</td> 
<td valign="top"> 
<input type="text" name="field-3f92f5a7876cd50" id="field-3f92f5a7876cd50" size="40" value="" /> 

</td> 

<tr> 
<td valign="top"> 
<strong>Sub Total: </strong> 
</td> 
<td valigh="top"> 
<input type="text" id="totalcost" name="totalcost" size="40" value=""> 

</td> 

<tr> 

<td colspan="2" align="center"> 
<input type="submit" value=" Submit Form " /> 
</td> 

</tr> 

</form> 

 

 

<script type="text/javascript">
function UpdateCost() {
var sum = 0;
var gn, elem, totalAmmount, peopleNum;
for (i=0; i<7; i++) {
gn = 'game'+i;
if(gn != 'game6'){
elem = document.getElementById(gn);
if (elem.checked == true) { sum += Number(elem.value); }
}
peopleNum = document.getElementById('field-5af722f60ee2f9b').value;
if(isNaN(peopleNum ) || peopleNum==''){
totalAmmount = sum;
}
else{
totalAmmount = sum * peopleNum;
}
}
if(document.getElementById('game6').checked == true)
{
totalAmmount += Number(document.getElementById('game6').value);
}
document.getElementById('totalcost').value = totalAmmount.toFixed(2);
}
</script>

<script type="text/javascript">
var value="";
var numPeople=document.getElementById("field-5af722f60ee2f9b")
numPeople.onkeydown=function(e){
    value = this.value + e;
}

numPeople.onkeyup=function(e) {
this.value=this.value.replace(/[^\d]/,'');
    if(this.value != value) {
        UpdateCost();
    }
}
</script>

</body>
</html>
<?php endif; ?>



Javascript:
/* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com Created by: Jay Rumsey | http://www.nova.edu/~rumsey/ */

function UpdateCost() {
var sum = 0;
var gn, elem, totalAmmount, peopleNum;
for (i=0; i<7; i++) {
gn = 'game'+i;
if(gn != 'game6'){
elem = document.getElementById(gn);
if (elem.checked == true) { sum += Number(elem.value); }
}
peopleNum = document.getElementById('field-5af722f60ee2f9b').value;
if(isNaN(peopleNum ) || peopleNum==''){
totalAmmount = sum;
}
else{
totalAmmount = sum * peopleNum;
}
}
if(document.getElementById('game6').checked == true)
{
totalAmmount += Number(document.getElementById('game6').value);
}
document.getElementById('totalcost').value = totalAmmount.toFixed(2);
}

 

 

Thank you

 

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.