I'm trying to grab data (date_php) from a SQL table (aaa_rates)... I can grab the data to populate the drop down, however, when I select the data, it is not shown when I click the submit button...
Here is my code.
<h2>Historical Fuel Prices</h2>
<img src="/images/gas pump.jpg" border="0" />
<?php
// display the two recent fuel prices (this week & last week)
$count=0;
$sql="SELECT date_php,price FROM aaa_rates WHERE date_php!='$date' ORDER BY date_php desc";
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result)) {
$displaydate=date("F j, Y",strtotime($row['date_php']));
if($count<2) {
echo "<table width=550><tr>
<td width=100><span class='mediumtext'>$displaydate</span></td><td align=left><span class='mediumtext'>$ $row[price]</span></td></tr></table>";
} else {
$options.="<option value=\"/x/pittsburghtrib/specialreports/risingfuelcosts/?d={$row['date_php']}\">$displaydate</option>";
}
$count++;
}
?>
<p><i><span class='mediumtext'>The average price of a gallon of regular, unleaded, self-serve gasoline in Western Pennsylvania, according to AAA.</span></i></p>
<p><a href=""><span class='mediumtext'>Click here</a> to see historical prices</span></p>
<div style="clear:both;">
<h3> Older dates:</h3>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method=post>
<select name="name">
<option value="">Select</option>
<?php echo $options;?>
</select>
<? echo "<input type=\"submit\" value=\"Go Now\" />
</form>";?>
</div>
posting data- PHP/HTML
Moderator: General Moderators
Re: posting data- PHP/HTML
This whole thing is your value?
I dont believe != is a valid operator , it should be <>
Code: Select all
/x/pittsburghtrib/specialreports/risingfuelcosts/?d={$row['date_php']}
Code: Select all
$sql="SELECT date_php,price FROM aaa_rates WHERE date_php!='$date' ORDER BY date_php desc";