Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
posting forms problem Please help.
Old 04-01-2005, 04:23 AM posting forms problem Please help.
Average Talker

Posts: 17
Trades: 0
Hello,

I am pretty new to webdesign and I am currently in the throws of building myself a more profesional website. It's been a steep learning curve but i am slowly getting there.

Here is my problem:

I am using Dreamweaver MX 2004 with php 5.* and I am creating a static website, had to many nightmare trying to figure out dynamic.

Anyway I have a form on my site which calculate a visitors BMI and What I want to do is when they select the submit button I want the form info to be emailed to me as well as give them the results. And I don't want it to redirect them either, just show the results on the same page.

I can get it to do one or the other but not both. My question is can this be done?

If anyone can help me out I would really appreciate it.

Thanks

Angie

Here is my page code so far:



HTML Code:
<html>
<head>
<title>mydomain BMI Calculator </title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="copyright" content="mydomain 2005">
<meta name="rating" content="SAFE FOR KIDS">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../styles/herbalstyle.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function custom_print() {
if (document.all) {
if (navigator.appVersion.indexOf("5.0") == -1) {
var OLECMDID_PRINT = 6;
var OLECMDEXECOPT_DONTPROMPTUSER = 2;
var OLECMDEXECOPT_PROMPTUSER = 1;
var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
WebBrowser1.ExecWB(6, 2);
WebBrowser1.outerHTML = "";
} else {
self.print();
}
} else {
self.print();
}
}
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
<!-- Begin
function mod(div,base) {
return Math.round(div - (Math.floor(div/base)*base));
}
function calcBmi() {
var w = document.bmi.weight.value * 1;
var HeightFeetInt = document.bmi.htf.value * 1;
var HeightInchesInt = document.bmi.hti.value * 1;
HeightFeetConvert = HeightFeetInt * 12;
h = HeightFeetConvert + HeightInchesInt;
displaybmi = (Math.round((w * 703) / (h * h)));
var rvalue = true;
if ( (w <= 35) || (w >= 500) || (h <= 48) || (h >= 120) ) {
alert ("Invalid data. Please check and re-enter!");
rvalue = false;
}
if (rvalue) {
if (HeightInchesInt > 11) {
reminderinches = mod(HeightInchesInt,12);
document.bmi.hti.value = reminderinches;
document.bmi.htf.value = HeightFeetInt + 
((HeightInchesInt - reminderinches)/12);
document.bmi.answer.value = displaybmi;
}
if (displaybmi <19) 
document.bmi.comment.value = "Underweight - Our gain programme can help you to gain weight safely and effectively.";
if (displaybmi >=19 && displaybmi <=25) 
document.bmi.comment.value = "Ideal - You may wish to maintain your weight.";
if (displaybmi >=26 && displaybmi <=29) 
document.bmi.comment.value = "Overweight - We can help you to get in shape and lose those extra pounds.";
if (displaybmi >=30 && displaybmi <=40) 
document.bmi.comment.value = "Obese - You are prone to health risks such as Heart Disease and Diabetese. Let us Help you to Help yourself.";
if (displaybmi >40) 
document.bmi.comment.value = "Extremely obese - Read what our customers have to say about our products and how we helped them to lose weight and improve their overall well-being.";
document.bmi.answer.value = displaybmi; }
return rvalue;
}
// End -->

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<style type="text/css">
<!--
.style9 {
font-size: 24px;
font-weight: bold;
}
.style12 {font-size: x-small}
.style13 {color: #003399}
.style14 {font-size: 12px; }
.style15 {color: #FFFFFF}
.style16 {font-size: x-small; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style18 {color: #FF0000}
.style19 {font-weight: bold}
.style20 {font-weight: bold; font-size: x-small; }
.style5 {font-size: small}
.style21 {
font-weight: bold;
color: #0044D2;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
}
.style23 {color: #0044D2; font-size: x-small;}
.style26 {font-size: x-small; color: #003399; }
-->
</style>
<meta name="keywords" content="">
</head>
<body bgcolor="#FFFFFF" background="../images/pop_bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../images/select_heart.gif','../images/select_diabetes.gif')"><meta name="keywords" content="">
<meta name="description" content="">

<body><form action="http://www.mydomain.info/cgi-bin/NMSFormMail.pl" method="post" name="BMIChallenge" id="BMIChallengeForm">
<input type="hidden" name="recipient" value="myemail@mydomain.info" />
<input type=hidden name="redirect" value="http://www.mydomain.info/done.htm">
<input type=hidden name="subject" value="BMI Challenge Form">
<input type=hidden name="env_report" value="REMOTE_HOST"><table width="698" border="0" cellspacing="0" cellpadding="0">
<!--DWLayoutTable-->
<tr>
<td height="4" colspan="2"><img src="../images/spacer.gif" width="500" height="4"></td>
</tr>
<tr bgcolor="#FFCC66">
<td height="2" colspan="2"><img src="../images/spacer.gif" width="500" height="2"></td>
</tr>
<tr>
<td height="4" colspan="2"><img src="../images/spacer.gif" width="500" height="4"></td>
</tr>
<tr>
<td width="16" height="30">&nbsp;</td>
<td width="682" valign="top" bgcolor="#FFFFCC" class="PopTitle"> <div align="center" class="style9">BMI CHALLENGE </div></td>
</tr>
</table>
<table width="699" border="0" cellspacing="0" cellpadding="0">
<!--DWLayoutTable-->
<tr> 
<td width="1" height="352"> 
<td width="696" rowspan="2" valign="top"> <table width="696" border="0" cellspacing="0" cellpadding="0">
<!--DWLayoutTable-->
<tr>
<td width="19" height="413">&nbsp;</td>
<td width="677" align="center" valign="top"> 
<table width="614" border="0" cellspacing="0" cellpadding="2">
<!--DWLayoutTable-->
<tr> 
<td height="72" colspan="20" valign="top"><div align="center">
<p class="PopTitle"><font face="Verdana, Arial, Helvetica, sans-serif"><b><span class="PopTitle style18">Do you shape up?</span><br>
<span class="PopTitle">Fill in the fields below to accept our Challenge.</span></b></font></p>
</div></td>
<td width="6">&nbsp;</td>
</tr>
<tr>
<td width="80" height="1"></td>
<td width="16"></td>
<td width="39"></td>
<td width="3"></td>
<td width="2"></td>
<td width="2"></td>
<td width="86"></td>
<td width="132"></td>
<td width="2"></td>
<td width="2"></td>
<td width="2"></td>
<td width="2"></td>
<td width="2"></td>
<td width="2"></td>
<td width="4"></td>
<td width="98"></td>
<td width="8"></td>
<td width="38"></td>
<td width="2"></td>
<td width="2"></td>
<td></td>
</tr>
<tr>
<td height="24"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td colspan="4" rowspan="11" valign="middle"><div align="center"><img src="../Images/photos/pop_acrobat.jpg" width="160" height="169"></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
</tr>
<tr>
<td rowspan="2" valign="middle"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Name:</font></b></p></td>
<td height="26" colspan="4" valign="middle"> 
<p class="style12"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style12 style13 style21"><span class="style12 style13">First</span></span></font></p></td>
<td colspan="6" valign="top"><input name="First name" type="text" class="style21" id="First name"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26" colspan="4" valign="top"><span class="header"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style26">Last</span></font></span></td>
<td colspan="5" valign="top"><input name="Last Name" type="text" class="style21" id="Last Name"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="7"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td rowspan="3" valign="middle"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Telephone:</font></b></p></td>
<td height="26" colspan="4" valign="middle"><p><b> 
<font face="Verdana, Arial, Helvetica, sans-serif"><span class="header style12 style13"><span class="style14">Daytime</span></span></font></b></p></td>
<td colspan="8" valign="top"><p align="left"><b><font face="Verdana, Arial, Helvetica, sans-serif"><span class="header style12">
<input name="Daytime Telephone " type="text" class="style21" id="Daytime Telephone ">
</span></font></b></p></td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="26" colspan="4" valign="middle"><b><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style13"><span class="style16">Evening</span></span><span class="header style12"><span class="style15">..</span> <span class="style15"> </span></span></font></b></td>
<td colspan="7" valign="top"><input name="Evening Telephone " type="text" class="style21" id="Evening Telephone "></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="26" colspan="3" valign="top"><b><font face="Verdana, Arial, Helvetica, sans-serif"><span class="header style12"><span class="style13">Mobile</span><span class="style15">..</span></span></font></b></td>
<td>&nbsp;</td>
<td colspan="7" valign="top"><input name="Telephone" type="text" class="style21" id="Telephone"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="14"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26" colspan="5" valign="top"><p align="left"><font face="Verdana, Arial, Helvetica, sans-serif" class="header style12 style13"><b>Email Address : </b></font></p></td>
<td colspan="7" valign="top"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> 
<input name="Email Address" type="text" class="style21" id="Email Address" value="" size="36" maxlength="100">
</font></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="14"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26" colspan="2" valign="middle"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Height:</font></b></p></td>
<td></td>
<td></td>
<td></td>
<td colspan="7" valign="top"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><span class="style13"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style5">
<input name="Feet" type=text class="style21" id="htf" size=1 maxlength=1>
</span></font></span><span class="style20"><font face="Verdana, Arial, Helvetica, sans-serif"><strong>Ft</strong></font></span><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style13"><span class="style5"><strong> <input name="Inches" type=text class="style21" id="hti" size=2 maxlength=2>
</strong></span></span>
<span class="style20"><strong><strong>In</strong>. </strong></span></font><strong> 
</strong></font></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="36"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td colspan="14" valign="middle"> 
<span class="style12"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style19"><font face="Verdana, Arial, Helvetica, sans-serif">Need help converting your height to Feet and inches? Click here. </font></span><font face="Verdana, Arial, Helvetica, sans-serif">&nbsp;&nbsp;</font></font></span></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="22"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="26" colspan="2" valign="top"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Weight:</font></b></p></td>
<td></td>
<td></td>
<td></td>
<td colspan="12" valign="top"><span class="style5"><font face="Verdana, Arial, Helvetica, sans-serif">
<input name="Weight" type=text class="style21" id="weight" onBlur="MM_validateForm('First name','','R','Last Name','','R','Daytime Telephone ','','R','Evening Telephone ','','R','Email Address','','RisEmail','htf','','R','hti','','R'); return document.MM_returnValue" SIZE=3 maxlength=3>
<strong class="style20">lbs. </strong></font></span></td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="36"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td colspan="14" valign="top"><span class="style20"><font face="Verdana, Arial, Helvetica, sans-serif">Need help converting your weight to pounds? click here. </font></span></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="13"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="22" colspan="2" valign="middle"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Sex:</font></b></p></td>
<td></td>
<td></td>
<td></td>
<td colspan="12" valign="middle"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> 
<input name="radSex" type="radio" value="F" checked>
<span class="style20">female 
</span>
<input type="radio" name="radSex" value="M">
<span class="style20"> male</span></font></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="9"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="41" colspan="21" valign="top"><span class="style12">&quot;I wish to receive further information about 
related products&quot; Please read our <a href="../hf_general/pop_privacypolicy.htm" class="style20" onClick="window.open(this.href,'newWin','width=450, height=400, scrollbars');return false;">Privacy 
Policy</a> for conditions of use 
<input name="chkPrivacy" type="checkbox" id="chkPrivacy" value="1">
</font></span> &nbsp;</td>
</tr>
<tr>
<td height="28"></td>
<td></td>
<td></td>
<td></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="28"></td>
<td></td>
<td></td>
<td></td>
<td colspan="12" valign="middle"><p> 
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<span class="header"></span></font><span class="header"><font size="1"></font></span><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><span class="header">
<input name="Submit" type=submit class="header" value="Calculate BMI">
</span></font><font size="1"><br>
</font>

</p></td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="31"></td>
<td></td>
<td></td>
<td></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="26" colspan="3" valign="top"><b class="style20"><font face="Verdana, Arial, Helvetica, sans-serif"><B>Body Mass Index</B>
</font> </b></td>
<td>&nbsp;</td>
<td colspan="4" valign="top"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input name=answer type=text class="style21" size=3>
</font></b></td>
<td>&nbsp;</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="13"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="1070" colspan="21" valign="top"><p align="left"><font face="Verdana, Arial, Helvetica, sans-serif" class="style20">According to the Panel on Energy, Obesity, and Body Weight Standards published by American Journal of Clinical</font> <font face="Verdana, Arial, Helvetica, sans-serif"><span class="style20">Nutrition, your category is: </span></font><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
</font></p> <p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<textarea name="comment" cols="52" rows="3" class="style21"></textarea>
</font></p> <p class="style20"><font face="Verdana, Arial, Helvetica, sans-serif">Complete our<a href="../New_questionnaires/pop_Gen_questionnaire.htm"> on-line questionaire</a> today and Let Us Help You To Help Yourself </font></p> 
<body/>

</html>
angief is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-01-2005, 05:49 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
hello angief, mmm WYSIWYG editors eh? I hate them, makes the HTML look very messy. But that's not your question.

It is indeed possible to be able to present results while mailing these results to you, without redirecting, this is the joy of dynamic pages! Have you used PHP before?

I would suggest something like this:

PHP Code:
<?php

if ($_POST['a'] == 'submit') {  // Because Form Method = POST

/* You can present the submitted information to the user still using HTML, using the echo()
function. The echo() will not understand if you put PHP in HTML, you have to seperate this, using ' . $PHP . ' this will become clear however. */

$frm_FirstName $_POST['First Name'];
$frm_SecondName $_POST['Second Name'];

echo(
'
<HTML>
<HEAD>
 <TITLE>My Form Results</TITLE>
</HEAD>

<BODY>
First Name: ' 
$frm_FirstName ' <BR>
Second Name: ' 
$frm_SecondName ' <BR>
'
);

/* And so on and so on, I'm not coding the whole thing! You can format it how you like. Just a hint, make sure your Form Inputs are named using whole words only, without spaces - using whole words is slightly frowned upon and can cause errors. Now we need to mail it. PHP uses a mail() function to email, much simpler than Perl and such like. */

$To 'your@emailaddress.com';
$Subject 'Form Results';

/* For the $content variable (what is actually contained in the email) you're going to need to make it, use the same method as presenting the results of the form to the user, but instead of echo() we need to use $Content = ' '; placing the HTML and PHP inside the '' */

// I wont explain the headers part, i think thats kinda obvious? 
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "Content-transfer-encoding: 8bit\n";

mail($To$Subject$Content$headers);

exit; 
// Stop going onto the form

// close the if-then-else argument
?>
This closes the PHP


Place this right at the top of the HTML document, and rename the extension of the HTML document to .php or whatever your server demands. Hopefully, this is a rough guideline that will help you, but please PLEASE read up on PHP from the website, as well as many Dev sites, or of course learn from other peoples work!

Oh Yeah, at the beginning is the argument if $_POST[a] = submit. Remember to place a hidden field in the submit form with name=a value=submit

Hope this helps!

Last edited by leavethisplace; 04-01-2005 at 05:50 AM.. Reason: forgot to close the PHP section!
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-01-2005, 06:44 AM
amw_drizz's Avatar
Ultra Talker

Posts: 340
Name: Jon
Location: New York
Trades: 0
he i was on the same path a year ago when i bought my first domain name. i used front page and did nothing with dynamic content. eventullay i switched from static to dynamic. once you goto dynamic you'll say i wished i did this earlier. php is a great serverside scipt reliable if coded right.
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1
amw_drizz is offline
Reply With Quote
View Public Profile Visit amw_drizz's homepage!
 
Old 04-01-2005, 10:41 AM
Average Talker

Posts: 17
Trades: 0
Hello,

Thanks for replying. I do use a bit of php but not manual code as I am sure you know dreamweaver does all that for you. I also use webassist shopping cart. It is only now that I feel useless as I have never coded a single thing in my life and a lot of what i read tends to go straight over my head half the time. But i guess that is all part of the learning process.

I was trying to get my dreamweaver to see my sql database but it's not working and macromedia and webassist are trying to help me here, there is a known fault apparently.

Anyway I will try your suggestions and see what happens. Fingers crossed.

Cheers
Angie
angief is offline
Reply With Quote
View Public Profile
 
Old 04-04-2005, 06:27 PM Still can't get this to work !!!! NOW DESPERATE FOR HELP!
Average Talker

Posts: 17
Trades: 0
It's me again,

I have been trying really hard to get this to work but I keep getting syntax errors such as:

Parse error: syntax error, unexpected T_STRING in d:\Inetpub\wwwroot\weight_management\bmi.php on line 10

Please can someone give me a hand here, it's now taken over 2 weeks to get to this stage trying this and that and I can't get it to work.

I know it's probably something obvious to those of you that can do PHP but to this NEWBY it's making my hair fall out.

Thanks in advance for any help.
Angie

HTML Code:
<?php ;

if($_POST['bmi'] = 'submit') 
{ 

$frm_FirstName = $_POST['First Name']; 
$frm_SecondName = $_POST['Second Name'];
$frm_DaytimeTelephone = $_POST['Daytime Telephone'];
$frm_EveningTelephone = $_POST['Evening Telephone'];
$frm_ EmailAddress = $_POST['Email Address'];
$To = 'myemail@mydomain.co.uk'; 
$Subject = 'Customer Enquiry Form'; 
mail($To, $Subject, $Content, $headers); 

exit; } 

echo(' 
<html>
<head>
<title>BMI Calculator </title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="copyright" content="mydomain2005">
<meta name="rating" content="SAFE FOR KIDS">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../styles/herbalstyle.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function custom_print() {
    if (document.all) {
        if (navigator.appVersion.indexOf("5.0") == -1) {
            var OLECMDID_PRINT = 6;
            var OLECMDEXECOPT_DONTPROMPTUSER = 2;
            var OLECMDEXECOPT_PROMPTUSER = 1;
            var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
            document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
            WebBrowser1.ExecWB(6, 2);
            WebBrowser1.outerHTML = "";
        } else {
            self.print();
        }
    } else {
        self.print();
    }
}
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
<!-- Begin
function mod(div,base) {
return Math.round(div - (Math.floor(div/base)*base));
}
function calcBmi() {
var w = document.bmi.weight.value * 1;
var HeightFeetInt = document.bmi.htf.value * 1;
var HeightInchesInt = document.bmi.hti.value * 1;
HeightFeetConvert = HeightFeetInt * 12;
h = HeightFeetConvert + HeightInchesInt;
displaybmi = (Math.round((w * 703) / (h * h)));
var rvalue = true;
if ( (w <= 35) || (w >= 500) || (h <= 48) || (h >= 120) ) {
alert ("Invalid data. Please check and re-enter!");
rvalue = false;
}
if (rvalue) {
if (HeightInchesInt > 11) {
reminderinches = mod(HeightInchesInt,12);
document.bmi.hti.value = reminderinches;
document.bmi.htf.value = HeightFeetInt + 
((HeightInchesInt - reminderinches)/12);
document.bmi.answer.value = displaybmi;
}
if (displaybmi <19) 
document.bmi.comment.value = "Underweight - ";
if (displaybmi >=19 && displaybmi <=25) 
document.bmi.comment.value = "Ideal - ";
if (displaybmi >=26 && displaybmi <=29) 
document.bmi.comment.value = "Overweight - ";
if (displaybmi >=30 && displaybmi <=40) 
document.bmi.comment.value = "Obese - ";
if (displaybmi >40) 
document.bmi.comment.value = "Extremely obese - ";
document.bmi.answer.value = displaybmi; }
return rvalue;
}
// End -->

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</script>
<style type="text/css">
<!--
.style9 {
	font-size: 24px;
	font-weight: bold;
}
.style12 {font-size: x-small}
.style13 {color: #003399}
.style14 {font-size: 12px; }
.style15 {color: #FFFFFF}
.style16 {font-size: x-small; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style18 {color: #FF0000}
.style19 {font-weight: bold}
.style20 {font-weight: bold; font-size: x-small; }
.style5 {font-size: small}
.style21 {
	font-weight: bold;
	color: #0044D2;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
}
.style23 {color: #0044D2; font-size: x-small;}
.style26 {font-size: x-small; color: #003399; }
.style27 {font-weight: bold; font-size: x-small; color: #FF0000; }
-->
</style>
<meta name="keywords" content="">
</head>
<body bgcolor="#FFFFFF" background="../images/pop_bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('../images/select_heart.gif','../images/select_diabetes.gif')"><meta name="keywords" content=" ">
<meta name="description" content=".">

<body><form action="http://www.mydomain.co.uk/cgi-bin/NMSFormMail.pl" method="post" name="bmi" id="bmi">
        <input type="hidden" name="recipient" value="myemail@mydomain.co.uk" />
        <input type=hidden name="subject" value="BMI Challenge Form">
        <input type=hidden name="env_report" value="REMOTE_HOST"><table width="698"  border="0" cellspacing="0" cellpadding="0">
  <!--DWLayoutTable-->
<tr>
<td height="4" colspan="2"><img src="../images/spacer.gif" width="500" height="4"></td>
</tr>
<tr bgcolor="#FFCC66">
<td height="2" colspan="2"><img src="../images/spacer.gif" width="500" height="2"></td>
</tr>
<tr>
<td height="4" colspan="2"><img src="../images/spacer.gif" width="500" height="4"></td>
</tr>
<tr>
<td width="16" height="30">&nbsp;</td>
<td width="682" valign="top" bgcolor="#FFFFCC" class="PopTitle"> <div align="center" class="style9">BMI CHALLENGE </div></td>
</tr>
</table>
<table width="699" border="0" cellspacing="0" cellpadding="0">
  <!--DWLayoutTable-->
  <tr> 
  <td width="1" height="352">      
  <td width="696" rowspan="2" valign="top">          <table width="696" border="0" cellspacing="0" cellpadding="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="19" height="413">&nbsp;</td>
            <td width="677" align="center" valign="top"> 
              <table width="614" border="0" cellspacing="0" cellpadding="2">
                <!--DWLayoutTable-->
                <tr> 
                  <td height="72" colspan="20" valign="top"><div align="center">
                      <p class="PopTitle"><font face="Verdana, Arial, Helvetica, sans-serif"><b><span class="PopTitle style18">Do you shape up?</span><br>
                          <span class="PopTitle">Fill in the fields below to accept our  Challenge.</span></b></font></p>
                  </div></td>
                  <td width="6">&nbsp;</td>
                </tr>
                <tr>
                  <td width="80" height="1"></td>
                  <td width="16"></td>
                  <td width="39"></td>
                  <td width="3"></td>
                  <td width="2"></td>
                  <td width="2"></td>
                  <td width="86"></td>
                  <td width="132"></td>
                  <td width="2"></td>
                  <td width="2"></td>
                  <td width="2"></td>
                  <td width="2"></td>
                  <td width="2"></td>
                  <td width="2"></td>
                  <td width="4"></td>
                  <td width="98"></td>
                  <td width="8"></td>
                  <td width="38"></td>
                  <td width="2"></td>
                  <td width="2"></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="24"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td colspan="4" rowspan="11" valign="middle"><div align="center"><img src="../Images/photos/pop_acrobat.jpg" width="160" height="169"></div></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                </tr>
                <tr>
                  <td rowspan="2" valign="middle"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Name:</font></b></p></td>
                  <td height="26" colspan="4" valign="middle"> 
                    <p class="style12"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style12 style13 style21"><span class="style12 style13">First</span></span></font></p></td>
                <td colspan="6" valign="top"><input name="First name" type="text" class="style21" id="First name"></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="26" colspan="4" valign="top"><span class="header"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style26">Last</span></font></span></td>
                  <td colspan="5" valign="top"><input name="Last Name" type="text" class="style21" id="Last Name"></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="7"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td rowspan="3" valign="middle"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Telephone:</font></b></p></td>
                  <td height="26" colspan="4" valign="middle"><p><b> 
                  <font face="Verdana, Arial, Helvetica, sans-serif"><span class="header style12 style13"><span class="style14">Daytime</span></span></font></b></p></td>
                <td colspan="8" valign="top"><p align="left"><b><font face="Verdana, Arial, Helvetica, sans-serif"><span class="header style12">
                      <input name="Daytime Telephone " type="text" class="style21" id="Daytime Telephone ">
                </span></font></b></p></td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="26" colspan="4" valign="middle"><b><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style13"><span class="style16">Evening</span></span><span class="header style12"><span class="style15">..</span> <span class="style15"> </span></span></font></b></td>
                  <td colspan="7" valign="top"><input name="Evening Telephone " type="text" class="style21" id="Evening Telephone "></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="26" colspan="3" valign="top"><b><font face="Verdana, Arial, Helvetica, sans-serif"><span class="header style12"><span class="style13">Mobile</span><span class="style15">..</span></span></font></b></td>
                  <td>&nbsp;</td>
                  <td colspan="7" valign="top"><input name="Telephone" type="text" class="style21" id="Telephone"></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="14"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="26" colspan="5" valign="top"><p align="left"><font face="Verdana, Arial, Helvetica, sans-serif" class="header style12 style13"><b>Email Address : </b></font></p></td>
                  <td colspan="7" valign="top"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> 
                    <input name="Email Address" type="text" class="style21" id="Email Address" value="" size="36" maxlength="100">
                  </font></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="14"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="26" colspan="2" valign="middle"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Height:</font></b></p></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td colspan="7" valign="top"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><span class="style13"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style5">
                    <input name="Feet" type=text class="style21" id="htf" size=1 maxlength=1>
                    </span></font></span><span class="style20"><font face="Verdana, Arial, Helvetica, sans-serif"><strong>Ft</strong></font></span><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style13"><span class="style5"><strong>                    <input name="Inches" type=text class="style21" id="hti" size=2 maxlength=2>
                    </strong></span></span>
                    <span class="style20"><strong><strong>In</strong>. </strong></span></font><strong> 
                      </strong></font></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="36"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td colspan="14" valign="middle"> 
                    <span class="style12"><font face="Verdana, Arial, Helvetica, sans-serif"><span class="style19"><font face="Verdana, Arial, Helvetica, sans-serif">Need help converting your height to Feet and inches? Click here. </font></span><font face="Verdana, Arial, Helvetica, sans-serif">&nbsp;&nbsp;</font></font></span></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="22"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td height="26" colspan="2" valign="top"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Weight:</font></b></p></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td colspan="12" valign="top"><span class="style5"><font face="Verdana, Arial, Helvetica, sans-serif">
                  <input name="Weight" type=text class="style21" id="weight" onKeyPress="MM_validateForm('First name','','R','Last Name','','R','Daytime Telephone ','','R','Evening Telephone ','','R','Email Address','','RisEmail','htf','','R','hti','','R');return document.MM_returnValue" SIZE=3 maxlength=3>
                  <strong class="style20">lbs. </strong></font></span></td>'); 
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="36"></td>
                 
                  <td colspan="14" valign="top"><span class="style27"><font face="Verdana, Arial, Helvetica, sans-serif">Need help converting your weight to pounds? click here. </font></span></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="13"></td>
                                  </tr>
                <tr>
                  <td height="22" colspan="2" valign="middle"><p><b class="header style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif">Sex:</font></b></p></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td colspan="12" valign="middle"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"> 
                    <input name="radSex" type="radio" value="F" checked>
                    <span class="style20">female 
                    </span>
                    <input type="radio" name="radSex" value="M">
                  <span class="style20">                  male</span></font></td>
                  <td></td>
                                  </tr>
                <tr>
                  <td height="9"></td>
                  <td></td>
                                  </tr>
                <tr>
                  <td height="41" colspan="21" valign="top"><span class="style12">&quot;I wish to receive further information about 
                                related products&quot; Please read our <a href="../hf_general/pop_privacypolicy.htm" class="style20" onClick="window.open(this.href,'newWin','width=450, height=400, scrollbars');return false;">Privacy 
                                Policy</a> for conditions of use 
                                <input name="chkPrivacy" type="checkbox" id="chkPrivacy" value="1">
                  </font></span>                                        &nbsp;</td>
                </tr>
                <tr>
                  <td height="28"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="28"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td colspan="12" valign="middle"><p> 
                      <font size="1" face="Verdana, Arial, Helvetica, sans-serif">
                      <span class="header"></span></font><span class="header"><font size="1"></font></span><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><span class="header">
                      <input name="Calculate_BMI" type=submit class="header" id="Calculate_BMI" 
onClick="MM_callJS('calcBmi()')" value="Calculate BMI">
                      </span></font><font size="1"><br>
        </font>
                          
                  </p></td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="31"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="26" colspan="3" valign="top"><b class="style20"><font face="Verdana, Arial, Helvetica, sans-serif"><B>Body Mass Index</B>
                  </font> </b></td>
                  <td>&nbsp;</td>
                  <td colspan="4" valign="top"><b><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
                    <input name=answer type=text class="style21" id="answer" size=3>
                  </font></b></td>
                  <td>&nbsp;</td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="13"></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                </tr>
                <tr>
                  <td height="1070" colspan="21" valign="top"><p align="left"><font face="Verdana, Arial, Helvetica, sans-serif" class="style20">According to the Panel on Energy, Obesity, and Body Weight Standards published by American Journal of Clinical</font> <font face="Verdana, Arial, Helvetica, sans-serif"><span class="style20">Nutrition, your category is: </span></font><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
</font></p>                    <p><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
                      <textarea name="comment" cols="52" rows="3" class="style21"></textarea>
                    </font></p>                    <p class="style20"><font face="Verdana, Arial, Helvetica, sans-serif">Complete our<a href="../New_questionnaires/pop_Gen_questionnaire.htm"> on-line questionaire</a> today and Let Us Help You To Help Yourself </font></p>                    <p><span class="style23 style12 style13"><font face="Verdana, Arial, Helvetica, sans-serif"><b><font face="Verdana, Arial, Helvetica, sans-serif">Please call us on 0208 2028246 for an informal chat or help at any time.</font></b></font></span></p>                    <p class="PopTitle style18"><strong><font face="Verdana, Arial, Helvetica, sans-serif">What does this mean to you? </font></strong></p>                    <p align="left"><span class="style12"><strong> &quot;BMI is not the only indicator of health risk.</strong>&quot;</span></p>                    <p align="left"><span class="style12">                      BMI is just one of many factors related to developing a chronic disease (such as heart disease, cancer, or diabetes). Other factors that may be important to look at when assessing your risk for chronic disease include: </span></p>                    <div align="left">
                      <ul>
                        <li class="style12"> Diet </li>
                        <li class="style12"> Physical Activity </li>
                        <li class="style12"> Waist Circumference </li>
                        <li class="style12"> Blood Pressure </li>
                        <li class="style12"> Blood Sugar Level </li>
                        <li class="style12"> Cholesterol Level </li>
                        <li class="style12"> Family History of disease </li>
                      </ul>
                      <p class="style12"> 
</form>
  <tr>
          <td>  
  </table>
</td>
  </tr>
</tr>
  <tr>
      
    <td>  
  </tr>
</table><!-- #BeginLibraryItem "/Library/pop_footer.lbi" -->

<script language="JavaScript" type="text/JavaScript">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}

//-->

</script>

<table width="698"  border="0" cellspacing="0" cellpadding="0">

<tr>

<td colspan="3"><img src="../images/spacer.gif" width="500" height="8"></td>

</tr>

<tr>

<td width="15" bgcolor="#FFFFCC">&nbsp;</td>

<td width="10" bgcolor="#FFFFCC">&nbsp;</td>

    <td width="625" align="center" bgcolor="#FFFFCC"><span class="copyrightPop">&copy; 
      mydomain2005&nbsp;&nbsp;&nbsp;&nbsp;Independent Herbalife Distributor&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" onClick="MM_openBrWindow('../hf_general/pop_disclaimer.htm','popup','scrollbars=yes,width=720,height=400')" id="copyrightPoplink">Disclaimer</a>&nbsp; 
      &nbsp;&nbsp;&nbsp;<a href="#" onClick="MM_openBrWindow('../hf_general/pop_privacypolicy.htm','popup','scrollbars=yes,width=720,height=400')" id="copyrightPoplink">Privacy 
      Policy</a></span></td>

</tr>

<tr>

<td colspan="3"><img src="../images/spacer.gif" width="500" height="4"></td>

</tr>

<tr bgcolor="#FFCC66">

<td colspan="3"><img src="../images/spacer.gif" width="500" height="2"></td>

</tr>

<tr>

<td colspan="3"><img src="../images/spacer.gif" width="500" height="4"></td>

</tr>

</table><!-- #EndLibraryItem --></body>
</html>
angief is offline
Reply With Quote
View Public Profile
 
Old 04-04-2005, 06:39 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
You don't need the ; after <?php, that might be throwing it off. Also you have a space in one of your variable names ($frm_EmailAddress).

If you want to output large blocks of HTML or javascript, I'd avoid the use of echo. It's much easier to just break out of php with a closing tag ?> after that everything that's written will be sent to the browser anyway. Then when you need more code just pop back into php with <?php again. That way it's clear what's going on 100 lines later, instead of wondering which set of quotes match up with which other quotes.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 04-04-2005, 06:41 PM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
Trades: 0
My quick take on it is that, looking at line 10:

PHP Code:
mail($To$Subject$Content$headers); 
I see where you set the $To and $Subject variables, but I can't see where you set the variables $Content and $headers.
__________________

Please login or register to view this content. Registration is FREE
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 04-04-2005, 07:02 PM
amw_drizz's Avatar
Ultra Talker

Posts: 340
Name: Jon
Location: New York
Trades: 0
all i have to say is holy S**** what a mess when you import it into dreamweaver mx 2004. one very long line. look at your code and make sure it is spread out through at least 50+ lines. if not you are going to have to break up the code into its right lines. and also instead of using the image veiw (the nice easy to work with veiw were you point and click) try looking into the coding side abit more and experiment with working on the code directly.

my new site is more in coding area of mx 2004 and zend studio w/ zend server side solutions. great for finding those pesky errors that dont always show up.
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1
amw_drizz is offline
Reply With Quote
View Public Profile Visit amw_drizz's homepage!
 
Old 04-04-2005, 07:21 PM OK Made some changes as suggested but got another error
Average Talker

Posts: 17
Trades: 0
Thanks for the speedy replies guys,

Well I made some changes and now get the following error:

Parse error: syntax error, unexpected T_STRING in d:\Inetpub\wwwroot\weight_management\bmi2.php on line 6

I have tried changes in everyway I can see to do but if I remove bits I get more errors etc etc.

Beleive me I have tried looking at the code and messing around with it, I have that many different test files on my server you would not believe. Once I get this frickin thing working then i will look at cleaning it up, priority is to try and get it to fricking work. ( Dreamweaver has a facility to clean up html but I hsvrn't tried it yet.

Thanks again for any assistance

Angie

This is the code I now have for the php part:

HTML Code:
<?php

if($_POST['bmi'] ='submit') 
{ 

$frm_First Name = $_POST['First Name']; 
$frm_Second Name = $_POST['Second Name'];
$frm_Daytime Telephone = $_POST['Daytime Telephone'];
$frm_Evening Telephone = $_POST ['Evening Telephone'];
$frm_Email Address = $_POST['Email Address'];
$To = 'myemail@mydomain.co.uk'; 
$Subject = 'Customer Enquiry Form'; 
mail($To, $Subject); 

exit; } 
?>
angief is offline
Reply With Quote
View Public Profile
 
Old 04-04-2005, 07:40 PM
amw_drizz's Avatar
Ultra Talker

Posts: 340
Name: Jon
Location: New York
Trades: 0
try
PHP Code:
<?php

if ($_POST['bmi'] ='submit') { 
$frm_First Name $_POST['First Name']; 
$frm_Second Name $_POST['Second Name'];
$frm_Daytime Telephone $_POST['Daytime Telephone'];
$frm_Evening Telephone $_POST ['Evening Telephone'];
$frm_Email Address $_POST['Email Address'];
$To 'myemail@mydomain.co.uk'
$Subject 'Customer Enquiry Form'
mail($To$Subject); 
exit; 

?>
i removed some of your spaces and put your { on the same line as your if statement and put } on its line
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1

Last edited by amw_drizz; 04-04-2005 at 07:42 PM..
amw_drizz is offline
Reply With Quote
View Public Profile Visit amw_drizz's homepage!
 
Old 04-04-2005, 07:48 PM
Average Talker

Posts: 17
Trades: 0
Frickin Nora now i know why i don't code.....

I tried your suggestion and now I have the same error in line 4 - is there a god??? I am so frustrated with this all I want is to post and calculate my frickin form... I never thought it would be this hard..

Sorry to keep coming back on this I am getting to the stage where I will pay some one to get this working for me as I am losing money...

Anymore ideas would be appreciated.

I have checked all my form tags and they are as per what the php says.

Thanks

Angie
angief is offline
Reply With Quote
View Public Profile
 
Old 04-04-2005, 09:04 PM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Quote:
$frm_Daytime Telephone
PHP will NOT understand this! You must set variable names as one word, otherwise it becomes a rather pointless, unexpected, thing in PHP. This is throwing in the error, otherwised known as a T_STRING. Try taking the spaces out of VARIABLE NAMES. Please, do not code things with spaces where they are not needed. If you need to express a new word in a variable name, use a UPPPERCASE Letter!

PHP Code:
$frm_DaytimeTelephone 
You don't seem to have followed my first suggestion, please do! It was mostly taken from my own scripts, all of which work fine (i know this because it is used in my own CMS system for bands and even a wholesaler of cakes!).

Try variables with no s p a c e s ! ! ! Also, you must have $message and $headers defined when using the mail() predifined function.

Try this before a repost!
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-05-2005, 02:25 AM Reply to leavthisplace
Average Talker

Posts: 17
Trades: 0
Thanks for the comments,

Actually I have tried to the best of my ability exactly what you said, and still got tonnes of errors, but if you will recall I am new to php and coding, hence needed someone who is "patient " and "understanding" to help me.

I can imagine to you this is a very simple thing but to one who is completely blind it is frightening and extremely confusing

Did you find it "simple" when you first started? I imagine not...

I don't just come in here and post without trying everything I can first I can assure you. I have tried many, many hours on my own to get this going over the last 2 weeks.

Can I suggest that you try and be a bit more patient when you assist people on here and remember we don't know what you know - the reason we ask is because we don't know and we want to learn... We don't want to be chastised and told not to post again until we have tried it !!!
angief is offline
Reply With Quote
View Public Profile
 
Old 04-05-2005, 04:21 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
oh, im very sorry you thought i was being aggresive toward you! That was not my intention at all, I was just trying to make sure I got the point across

Trust me, I know all about the pains of trying to learn how to code, but when i was doing it there wasnt really many resources like this one and so I had to learn off my own back simply going through the php.net documentation! I recommend you read through some of that stuff, particularly for using the mail() function, not only is there a lot of instruction there, there is also a lot of useful comments left by some very experienced users of PHP.

Anyway, have you gotten that snippet of code to work now? Sorry again for sounding hostile, it's just how I sometimes come over when im trying to explain something quickly
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 04-05-2005, 04:41 AM Thanks for the reply
Average Talker

Posts: 17
Trades: 0
Thanks for the reply,

No worries, no offence taken. I have been trying to read as much as I can, perhaps too much really as everything seems to go straight over my head at the moment. Frustration is not a nice thing at all. I hate it when I can't do something...

But then if these things were easy everybody would be doing it eh !!

No I am still trying to get it to work. A chap has offered his services to help me get it right, clean up the mess of code that importing the page has made and what have you.

I will post again once it's sorted out which will hopefully be sooooooon

Cheers
Angie
angief is offline
Reply With Quote
View Public Profile
 
Old 04-05-2005, 08:28 AM
amw_drizz's Avatar
Ultra Talker

Posts: 340
Name: Jon
Location: New York
Trades: 0
before was a quick glance but after putting it into Zend Studio try this.

PHP Code:
<?php

if ($_POST['bmi'] ='submit') {
$frm_First_Name $_POST['First Name'];
$frm_Second_Name $_POST['Second Name'];
$frm_Daytime_Telephone $_POST['Daytime Telephone'];
$frm_Evening_Telephone $_POST ['Evening Telephone'];
$frm_Email_Address $_POST['Email Address'];
$To 'myemail@mydomain.co.uk';
$Subject 'Customer Enquiry Form';
mail($To$Subject);
exit;
}
?>
as php will not under stand $varible setup = 'this'; it will read $varible . to have it work right you need for spaces a spacer ie "_" for it to work.

for $varible_setup = 'this'; it will read $varible_setup = 'this';
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1
amw_drizz is offline
Reply With Quote
View Public Profile Visit amw_drizz's homepage!
 
Old 04-05-2005, 10:15 AM
Average Talker

Posts: 17
Trades: 0
Thanks for the reply, I am in the middle of testing another suggestion soI will try this if the other doesn't work thx. Don't want to confuse myself anymore than I already am.

Cheers
Angie
angief is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to posting forms problem Please help.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.90199 seconds with 12 queries