Jump to content


Photo

PHP and HTML table/forms


  • Please log in to reply
2 replies to this topic

#1 westmich

westmich
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 11 March 2006 - 03:21 AM

Hi I need some help here, I am not sure I am even going about it correctly. I was given a file, that is an HTML table/form, and I was told to program it with PHP. It is basically a contact page, but it is really huge, and I have only programmed flash contact pages with php, I thought that an html contact page would be simple but I thought wrong. I need someone to get me started in the right direction I have been all over the internet looking for help so now I am submitting my files to anyone who can help me out! I am getting desperate here, please help me!
Here is my PHP file:
<?

$to = "westboarder@msn.com";
$msg = "{$_POST['Name']}\n\n";
$msg .= "{$_POST['Message']}\n\n";
$msg .= "{$_POST['Company']}\n\n";
$msg .= "{$_POST['Title']}\n\n";
$msg .= "{$_POST['Phone']}\n\n";
$msg .= "{$_POST['Fax']}\n\n";
$msg .= "{$_POST['Address']}\n\n";
$msg .= "{$_POST['State/Province']}\n\n";
$msg .= "{$_POST['Country']}\n\n";
$msg .= "{$_POST['Zip']}\n\n";
$msg .= "{$_POST['email']}\n\n";


mail($to, $_POST['subject'], $msg, "From:{$_POST['email']}\r\nReply-To: {$_POST['email']}\r\n");

?>


And here is my html table/form (sorry, it is really long):

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 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_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<link href="include/style.css" rel="stylesheet" type="text/css">
</head>

<body onLoad="MM_preloadImages('images/nav/home_on.gif','images/nav/aboutus_on.gif','images/nav/ourprod_on.gif','images/nav/bell_on.gif','images/nav/eurocopter_on.gif','images/nav/md_helicopters_on.gif','images/nav/robinson_on.gif','images/nav/schweizer_on.gif','images/nav/sikorsky_on.gif','images/nav/downloads_on.gif','images/nav/submit_profile_on.gif','images/nav/contact_on.gif')">
<form name="emailform.php" method="post" action="">


<table width="770" height="650" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="770" height="120" align="left" valign="top"><table width="770" height="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="180" height="120" align="left" valign="top" bgcolor="A40910"><img src="images/shared/logo.gif" width="180" height="120"></td>
<td width="590" height="120" align="left" valign="top" background="images/header/headerclouds.jpg">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td width="770" height="480" align="left" valign="top"><table width="770" height="530" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="180" height="480" align="left" valign="top" bgcolor="A40910"><table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="180" height="5" align="left" valign="top"><img src="images/shared/whitespacer.gif" width="180" height="5"></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','images/nav/home_on.gif',1)"><img src="images/nav/home_off.gif" name="Image4" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="about.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image5','','images/nav/aboutus_on.gif',1)"><img src="images/nav/aboutus_off.gif" name="Image5" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="ourprod.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','images/nav/ourprod_on.gif',1)"><img src="images/nav/ourprod_off.gif" name="Image6" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><img src="images/nav/blanknav.gif" width="180" height="25"></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="bell.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image7','','images/nav/bell_on.gif',1)"><img src="images/nav/bell_off.gif" name="Image7" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="eurocopter.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image8','','images/nav/eurocopter_on.gif',1)"><img src="images/nav/eurocopter_off.gif" name="Image8" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="md_helicopters.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image9','','images/nav/md_helicopters_on.gif',1)"><img src="images/nav/md_helicopters_off.gif" name="Image9" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="robinson.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image10','','images/nav/robinson_on.gif',1)"><img src="images/nav/robinson_off.gif" name="Image10" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="schweizer.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image11','','images/nav/schweizer_on.gif',1)"><img src="images/nav/schweizer_off.gif" name="Image11" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="sikorsky.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image12','','images/nav/sikorsky_on.gif',1)"><img src="images/nav/sikorsky_off.gif" name="Image12" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><img src="images/nav/blanknav.gif" width="180" height="25"></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="downloads.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image14','','images/nav/downloads_on.gif',1)"><img src="images/nav/downloads_off.gif" name="Image14" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><img src="images/nav/request_for_quote_on.gif" width="180" height="25"></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="submit_profile.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image16','','images/nav/submit_profile_on.gif',1)"><img src="images/nav/submit_profile_off.gif" name="Image16" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="25" align="left" valign="top"><a href="contact.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image17','','images/nav/contact_on.gif',1)"><img src="images/nav/contact_off.gif" name="Image17" width="180" height="25" border="0"></a></td>
</tr>
<tr>
<td width="180" height="150" align="left" valign="top"><img src="images/nav/address.gif" width="180" height="150"></td>
</tr>
</table></td>
<td width="590" height="480" align="left" valign="top"><table width="590" height="530" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="590" height="30" align="left" valign="top"><table width="590" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="590" height="7" align="left" valign="top" bgcolor="#A40910"><img src="images/spacer/red_1x1.gif" width="1" height="7"></td>
</tr>
<tr>
<td width="590" height="23" align="left" valign="top" background="images/scrollingtext/placeholder.gif">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td width="590" height="500" align="left" valign="top"><table width="590" height="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="590" height="10" align="left" valign="top"><img src="images/spacer/white_1x1.gif" width="1" height="1"></td>
</tr>
<tr>
<td width="590" height="490" align="left" valign="top"><table width="590" height="490" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="590" height="180" align="left" valign="top"><table width="590" height="180" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="295" height="180" align="left" valign="top"><table width="295" height="180" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="295" height="150" align="left" valign="top"><table width="295" height="150" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" height="180" align="left" valign="top">&nbsp;</td>
<td width="285" height="180" align="left" valign="top" class="mainText"><p class="redTextTitle"><strong>Request For Quote</strong></p>
<p class="mainText"><br>
<strong class="blackTextTitle">Competitive pricing, fast</strong></p>
<p class="mainText">We would be pleased to provide you with a timely price quote for your helicopter replacement windows. Simply complete and submit this form, or call us at 1-817-246-4694. </p>
<p class="mainText">&nbsp;</p>
<p class="redTextTitle"><br>
</p></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="295" height="180" align="left" valign="top" background="images/image_295x180/ourproducts.jpg">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td width="590" height="310" align="left" valign="top"><table width="590" height="310" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" height="310" align="left" valign="top">&nbsp;</td>
<td width="570" height="310" align="left" valign="top" class="mainText"><TABLE cellSpacing="2" cellPadding="2" width="100%" border="0">
<TBODY>
<TR>
<TD align="right"><strong>Date</strong></TD>
<TD><INPUT size="30" name="Date"></TD>
</TR>
<TR>
<TD align="right"><strong>Company</strong></TD>
<TD><INPUT size="30" name="Company"></TD>
</TR>
<TR>
<TD align="right"><strong>Contact</strong></TD>
<TD><INPUT size="30" name="Contact"></TD>
</TR>
<TR>
<TD align="right"><strong>Address</strong></TD>
<TD><INPUT size="40" name="Address"></TD>
</TR>
<TR>
<TD align="right"><strong>City</strong></TD>
<TD><INPUT size="15" name="City"></TD>
</TR>
<TR>
<TD align="right"><strong>State/Province</strong></TD>
<TD><INPUT size="15" name="State/Province"></TD>
</TR>
<TR>
<TD align="right"><strong>Country</strong></TD>
<TD><INPUT size="15" name="Country"></TD>
</TR>
<TR>
<TD align="right"><strong>Zip/Postal Code</strong></TD>
<TD><INPUT size="6" name="Zip"></TD>
</TR>
<TR>
<TD align="right"><strong>Phone</strong></TD>
<TD><INPUT size="14" name="Phone"></TD>
</TR>
<TR>
<TD align="right"><strong>Fax</strong></TD>
<TD><INPUT size="14" name="Fax"></TD>
</TR>
<TR>
<TD align="right"><strong>Email</strong></TD>
<TD><INPUT name="email"></TD>
</TR>
</TBODY>
</TABLE>
<INPUT type="hidden" value="BEGIN_RFQ_PARTS" name="BEGIN_RFQ_PARTS">
<TABLE cellSpacing="4" cellPadding="1" width="100%" bgColor="#FFFFFF" border="0">
<TBODY>
<TR>
<TD align="middle"><strong>Part Number</strong></TD>
<TD align="middle"><strong>Description</strong></TD>
<TD align="middle"><strong>Qty</strong></TD>
</TR>
<TR>
<TD align="middle"><INPUT name="prt_1"></TD>
<TD align="middle">&nbsp;</TD>
<TD align="middle"><INPUT size="5" name="qty_1"></TD>
</TR>
<TR>
<TD align="middle"><INPUT name="prt_2"></TD>
<TD align="middle"><INPUT size="30" name="des_2"></TD>
<TD align="middle"><INPUT size="5" name="qty_2"></TD>
</TR>
<TR>
<TD align="middle"><INPUT name="prt_3"></TD>
<TD align="middle"><INPUT size="30" name="des_3"></TD>
<TD align="middle"><INPUT size="5" name="qty_3"></TD>
</TR>
<TR>
<TD align="middle"><INPUT name="prt_4"></TD>
<TD align="middle"><INPUT size="30" name="des_4"></TD>
<TD align="middle"><INPUT size="5" name="qty_4"></TD>
</TR>
</TBODY>
</TABLE>
<input size="30" name="des_1">
<TABLE cellSpacing="2" cellPadding="5" width="100%" border="0">
<TBODY>
<TR>
<TD align="middle"><INPUT name="reset" type="reset" value="reset form">
<INPUT name="submit" type="submit" value=" send request "></TD>
</TR>
</TBODY>
</TABLE> <p>&nbsp;</p>
</td>
<td width="10" height="310" align="left" valign="top">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>


</body>
</html>



This is my first time posting here so if I did things completely wrong I am very sorry, I'll do better next time! Thanks to anyone willing to help me out here.

#2 k.soule

k.soule
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts
  • LocationIllinois

Posted 11 March 2006 - 03:35 AM

Well, you stretched the page quite terribly...and you didn't even tell us your problem. You need to program that in PHP, that isn't a problem, though..."programming" it in PHP would be putting an echo before it line and making it impossible to read :)

So, two things, put the HTML in [ code ] tags! and describe what you intend to do with this page and script (obviously you are sending something via mail, is that your problem?).

#3 rscott7706

rscott7706
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationLakeside CA

Posted 11 March 2006 - 07:57 AM

This is a conglomeration of two separate things that should not be together.

You have a php file that should stay separate from the html file.

The html file is an html page with a form for submitting info to an email name in the php file.

The html file should reference a "get" to the php file. And the reference to the php file is in the wrong place.

Do these things and it will work.

1. Cut the whole section of php (start at <?php and go to ?>) and save it as "emailform.php".

2. In the php file check the email name - is that the right one for who you want to get the results of the form submittal if not, change if so leave alone.

3. In the php text find this section:

<body onLoad="MM_preloadImages('images/nav/home_on.gif','images/nav/aboutus_on.gif','images/nav/ourprod_on.gif','images/nav/bell_on.gif','images/nav/eurocopter_on.gif','images/nav/md_helicopters_on.gif','images/nav/robinson_on.gif','images/nav/schweizer_on.gif','images/nav/sikorsky_on.gif','images/nav/downloads_on.gif','images/nav/submit_profile_on.gif','images/nav/contact_on.gif')">
<form name="emailform.php" method="post" action="">

The mistake is that the form is named "emailform.php" but the action should be "emailform.php"

Change it to this:

<body onLoad="MM_preloadImages('images/nav/home_on.gif','images/nav/aboutus_on.gif','images/nav/ourprod_on.gif','images/nav/bell_on.gif','images/nav/eurocopter_on.gif','images/nav/md_helicopters_on.gif','images/nav/robinson_on.gif','images/nav/schweizer_on.gif','images/nav/sikorsky_on.gif','images/nav/downloads_on.gif','images/nav/submit_profile_on.gif','images/nav/contact_on.gif')">
<form name="[!--coloro:#FF6666--][span style=\"color:#FF6666\"][!--/coloro--]Parts_Inv[!--colorc--][/span][!--/colorc--]" method="post" action="[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]emailform.php[!--colorc--][/span][!--/colorc--]">

(The Parts_Inv is just a suggestion - you should be able to use anything here.

4. Cut the whole html section out and save it as an html file (*.html) with whatever file name you feel is right (Part_Inv.html).

5. Load both to your server and it should work.

What it does it takes the users input and dends it through the php script to the email name.

It is a little clunky and I don't even think the php is needed since it just goes straight to an email name.

Hope this helps.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users