PDA

View Full Version : Form Issue - $_POST[''] doesnt work...



Bob Leny
Nov 12th, 2006, 12:31 AM
I have a form that someone could fill out, click a button, and it would display what they typed in.

index.htm

<html>
<head>
<title>F.C.I.T.S. - Form</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="print.htm" method="post">
<table cellspaceing="0" cellpadding="0" width="100%" align="center">
<tr>
<td colspan="3" align="left"><img src="big_block.png" alt="" /></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td>Consumer: <input type="text" name="consumer" size="20" /></td>
<td>Purchase From: <input type="text" name="purchase_from" size="20" /></td>
<td>#: <input type="text" name="#" width="20" /></td>
</tr>

<tr>
<td>Invoice Date: <input type="text" name="invoice_date_month" size="1" />-<input type="text" name="invoice_date_day" size="1" />-<input type="text" name="invoice_date_year" size="1" /></td>
<td>Address: <input type="text" name="address" size="20" /></td>
<td>Invoice #: <input type="text" name="invoice_#" size="20" /></td>
</tr>

<tr>
<td>Install Date: <input type="text" name="install_date_month" size="1" />-<input type="text" name="install_date_day" size="1" />-<input type="text" name="install_date_year" size="1" /></td>
<td>Commissioned By: <input type="text" name="commissioned_by" size="17" /></td>
<td>Inspection Date: <input type="text" name="inspection_date_month" size="1" />-<input type="text" name="inspection_date_day" size="1" />-<input type="text" name="inspection_date_year" size="1" /></td>
</tr>

<tr>
<td>Phone #: <input type="text" name="phone_#" size="20" /></td>
<td>Contacted By: <input type="text" name="contacted_by" size="20" /></td>
<td>Contact Date: <input type="text" name="contact_date_month" size="1" />-<input type="text" name="contact_date_day" size="1" />-<input type="text" name="contact_date_year" size="1" /></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td>Manufacture: <input type="text" name="manufacture" size="20" /></td>
<td>S.F. Inst: <input type="text" name="sf_inst" size="20" /></td>
<td>S.F. Involved: <input type="text" name="sf_involved" size="20" /></td>
</tr>

<tr>
<td>First Noticed: <input type="text" name="first_noticed_month" size="1" />-<input type="text" name="first_noticed_day" size="1" />-<input type="text" name="first_noticed_year" size="1" /></td>
<td>Floor Type: <input type="text" name="floor_type" size="20" /></td>
<td>Style #: <input type="text" name="style_#" size="20" /></td>
</tr>

<tr>
<td>Color: <input type="text" name="color" size="20" /></td>
<td>Grade: <input type="text" name="grade" size="20" /></td>
<td>Type of Install: <input type="text" name="type_of_install" size="20" /></td>
</tr>

<tr>
<td>Sub Floor: <input type="text" name="sub_floor" size="20" /></td>
<td>Underlayment: <input type="text" name="underlayment" size="20" /></td>
<td>Vapor Barrier: <input type="text" name="vapor_barrier" size="20" /></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td>Floor Location: <input type="text" name="flooring_location" size="20" /></td>
<td>Home Condition: <input type="text" name="home_condition" size="17" /></td>
<td>Install Method: <input type="text" name="install_method" size="20" /></td>
</tr>

<tr>
<td>Acclimation Time: <input type="text" name="acclimation_time" size="15" /></td>
<td>HVAC: <input type="text" name="hvac" size="20" /></td>
<td># Of Adults: <input type="text" name="#_of_adults" size="20" /></td>
</tr>

<tr>
<td># Of Children: <input type="text" name="#_of_children" size="20" /></td>
<td># Of Pets: <input type="text" name="#_of_pets" size="20" /></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td>Temp.: <input type="text" name="temp" size="4" /></td>
<td>Relative Humidity: <input type="text" name="relative_humidity" size="1" />%</td>
<td>Product Moisture: <input type="text" name="product_moisture" size="20" /></td>
</tr>

<tr>
<td>Subfloor Moisture: <input type="text" name="subfloor_moisture" size="15" /></td>
<td>Expansion Room: <input type="text" name="expansion_room" size="15" /></td>
<td>Craw Space: <input type="text" name="craw_space" size="20" /></td>
</tr>

<tr>
<td>Basement: <input type="text" name="basement" size="20" /></td>
<td>Moisture: <input type="text" name="moisture" size="20" /></td>
<td>Nailing Pattern: <input type="text" name="nailing_pattern" size="20" /></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td colspan="3">Cleaning Information: <input type="text" name="cleaning_information" size="100" /></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td colspan="3">Description of Compliant:</td>
</tr>

<tr>
<td colspan="3"><textarea name="description_of_compliant" cols="100" rows="10"></textarea></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td colspan="3">Conditions Observed:</td>
</tr>

<tr>
<td colspan="3"><textarea name="conditions_observed" cols="100" rows="10"></textarea></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td colspan="3">Inspection Conclusion:</td>
</tr>

<tr>
<td colspan="3"><textarea name="inspection_conclusion" cols="100" rows="10"></textarea></td>
</tr>
</table>
<input type="submit" value="Confirm & Print" />
</form>
</body>
</html>

print.htm

<html>
<head>
<title>F.C.I.T.S. - Look Good? Print It!</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table cellspaceing="0" cellpadding="0" width="100%" align="center">
<tr>
<td colspan="3" align="left"><img src="big_block.png" alt="" /></td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td>Consumer: $_POST['consumer']</td>
<td>Purchase From: $_POST['purchase_from']</td>
<td>#: $_POST['#']</td>
</tr>

<tr>
<td>Invoice Date: $_POST['invoice_date_month'] - $_POST['invoice_date_day'] - $_POST['invoice_date_year']</td>
<td>Address: $_POST['address']</td>
<td>Invoice #: $_POST['invoice_#']</td>
</tr>

<tr>
<td>Install Date: $_POST['install_date_month'] - $_POST['install_date_day'] - $_POST['install_date_year']</td>
<td>Commissioned By: $_POST['commissioned_by']</td>
<td>Inspection Date: $_POST['inspection_date_month'] - $_POST['inspection_date_day'] - $_POST['inspection_date_year']</td>
</tr>

<tr>
<td>Phone #: $_POST['phone_#']</td>
<td>Contacted By: $_POST['contacted_by']</td>
<td>Contact Date: $_POST['contact_date_month'] - $_POST['contact_date_day'] - $_POST['contact_date_year']</td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td>Manufacture: $_POST['manufacture']</td>
<td>S.F. Inst: $_POST['sf_inst']</td>
<td>S.F. Involved: $_POST['sf_involved']</td>
</tr>

<tr>
<td>First Noticed: $_POST['first_noticed_month'] - $_POST['first_noticed_day'] - $_POST['first_noticed_year']</td>
<td>Floor Type: $_POST['floor_type']</td>
<td>Style #: $_POST['style_#']</td>
</tr>

<tr>
<td>Color: $_POST['color']</td>
<td>Grade: $_POST['grade']</td>
<td>Type of Install: $_POST['type_of_install']</td>
</tr>

<tr>
<td>Sub Floor: $_POST['sub_floor']</td>
<td>Underlayment: $_POST['underlayment']</td>
<td>Vapor Barrier: $_POST['vapor_barrier']</td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td>Floor Location: $_POST['flooring_location']</td>
<td>Home Condition: $_POST['home_condition']</td>
<td>Install Method: $_POST['install_method']</td>
</tr>

<tr>
<td>Acclimation Time: $_POST['acclimation_time']</td>
<td>HVAC: $_POST['hvac']</td>
<td># Of Adults: $_POST['#_of_adults']</td>
</tr>

<tr>
<td># Of Children: $_POST['#_of_children']</td>
<td># Of Pets: $_POST['#_of_pets']</td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td>Temp.: $_POST['temp']</td>
<td>Relative Humidity: $_POST['relative_humidity']%</td>
<td>Product Moisture: $_POST['product_moisture']</td>
</tr>

<tr>
<td>Subfloor Moisture: $_POST['subfloor_moisture']</td>
<td>Expansion Room: $_POST['expansion_room']</td>
<td>Craw Space: $_POST['craw_space']</td>
</tr>

<tr>
<td>Basement: $_POST['basement']</td>
<td>Moisture: $_POST['moisture']</td>
<td>Nailing Pattern: $_POST['nailing_pattern']</td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td colspan="3">Cleaning Information: $_POST['cleaning_information']</td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td colspan="3">Description of Compliant:</td>
</tr>

<tr>
<td colspan="3">$_POST['description_of_compliant']</td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td colspan="3">Conditions Observed:</td>
</tr>

<tr>
<td colspan="3">$_POST['conditions_observed']</td>
</tr>

<tr>
<td colspan="3"><hr color="#000000" width="100%" /></td>
</tr>

<tr>
<td colspan="3">Inspection Conclusion:</td>
</tr>

<tr>
<td colspan="3">$_POST['inspection_conclusion']</td>
</tr>
</table>
</body>
</html>

I don't know what I'm doing wrong. I looked at forms I have scripted before and I can't figure out what I am doing wrong.

Can someone please tell me what I'm doing wrong?

Thanks!

mark87
Nov 12th, 2006, 12:32 AM
Firstly does your server even support PHP? That second page (the script) needs to be .php.

Bob Leny
Nov 12th, 2006, 12:41 AM
All my other forums are in a php format. And I thought I tried it in a php format, but I guess I didn't.

I will try it then, maybe it will work...

mark87
Nov 12th, 2006, 12:45 AM
It will need to be in .php and you will need to use the POST data like so:

<?php echo $_POST['invoice_date_month'] ?>

Bob Leny
Nov 12th, 2006, 12:56 AM
Thank you.

I've been scripting a forum from scratch for the past year now, you'd think I'd catch something like that.... lol

Thanks!