This has got to be one of those questions only a serious newbie would come up with....
Basicly: I select all the city names in the table and turn them into a pull down menu (code below)
[code=php]
print "<form action=\"update-city.php\" method=\"post\" name=\"theform\ ">";
print "<SELECT id=\"city\">\n" ;
while ($row =mysql_fetch_ob ject($result)) {
foreach ($row as $col=>$val){
print "<option value=\"\n";
print $val ;
print "\">";
print $val ;
print "</option>\n";
}
}
print "</select>\n";
?>
<!-- Finish the form -->
<input type="submit" name="action" value="Update City">
</form>
[/code]
Then I'm playing with it (working up the way to update) but all the variables seem empty. (Here's code for a simple table)
[code=php]
$sql = "SELECT city_name, city_default_zi p, seatac_price, boeing_price FROM char_city WHERE city_name = ('$city')";
$result = mysql_query($sq l)
or die(mysql_error ());
<table border="1">
<tr>
<td>City Name</td>
<td>Default Zip Code</td>
<td>Seatac Price</td>
<td>Boeing Price</td>
</tr>
<?
while ($row =mysql_fetch_as soc($result)) {
$lshit[] = $cityList[$row['id']] = $row['city_name'];
$shit[] = $cityList[$row['id']] = $row['city_default_z ip'];
$mshit[] = $cityList[$row['id']] = $row['seatac_price'];
$bshit[] = $cityList[$row['id']] = $row['boeing_price'];
print "<tr>\n";
foreach ($row as $col=>$val){
print "<td>\n";
print $val ;
print "</td>\n";
}//end for each
print "</tr>\n";
}//end while
?>
</table>[/code]
As you can see - it doesn't get any more simple.... So why doesn't it work? And what's really got me whacked out... Why doesn't it work in IE 6 or 7 - Yet works just fine in FireFox?
I read the forum sticky before posting so for some more info...
I installed...
error_reporting (E_ALL);
ini_set('displa y_errors', True);
Which now gives me "Notice: Undefined index: city in /home/content......" For both IE and FireFox - but Firefox at least still fills out the table...
I also tried....[code=php]
$sql = "SELECT city_name, city_default_zi p, seatac_price, boeing_price FROM char_city WHERE city_name = ('$_POST[city]')";[/code]
(and a few variations of where to put the quote)
and
[code=php]$city = $_POST['city'];
$sql = "SELECT city_name, city_default_zi p, seatac_price, boeing_price FROM char_city WHERE city_name = ('$city')";[/code]
Plus: I pulled the following out of a book regarding the global variables....
foreach [code=php]($_POST as $key => $value) {
$$key = $value;
}[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
Watch. I'm missing some little punctuation mark or something -
Anybody see my problem?
Basicly: I select all the city names in the table and turn them into a pull down menu (code below)
[code=php]
print "<form action=\"update-city.php\" method=\"post\" name=\"theform\ ">";
print "<SELECT id=\"city\">\n" ;
while ($row =mysql_fetch_ob ject($result)) {
foreach ($row as $col=>$val){
print "<option value=\"\n";
print $val ;
print "\">";
print $val ;
print "</option>\n";
}
}
print "</select>\n";
?>
<!-- Finish the form -->
<input type="submit" name="action" value="Update City">
</form>
[/code]
Then I'm playing with it (working up the way to update) but all the variables seem empty. (Here's code for a simple table)
[code=php]
$sql = "SELECT city_name, city_default_zi p, seatac_price, boeing_price FROM char_city WHERE city_name = ('$city')";
$result = mysql_query($sq l)
or die(mysql_error ());
<table border="1">
<tr>
<td>City Name</td>
<td>Default Zip Code</td>
<td>Seatac Price</td>
<td>Boeing Price</td>
</tr>
<?
while ($row =mysql_fetch_as soc($result)) {
$lshit[] = $cityList[$row['id']] = $row['city_name'];
$shit[] = $cityList[$row['id']] = $row['city_default_z ip'];
$mshit[] = $cityList[$row['id']] = $row['seatac_price'];
$bshit[] = $cityList[$row['id']] = $row['boeing_price'];
print "<tr>\n";
foreach ($row as $col=>$val){
print "<td>\n";
print $val ;
print "</td>\n";
}//end for each
print "</tr>\n";
}//end while
?>
</table>[/code]
As you can see - it doesn't get any more simple.... So why doesn't it work? And what's really got me whacked out... Why doesn't it work in IE 6 or 7 - Yet works just fine in FireFox?
I read the forum sticky before posting so for some more info...
I installed...
error_reporting (E_ALL);
ini_set('displa y_errors', True);
Which now gives me "Notice: Undefined index: city in /home/content......" For both IE and FireFox - but Firefox at least still fills out the table...
I also tried....[code=php]
$sql = "SELECT city_name, city_default_zi p, seatac_price, boeing_price FROM char_city WHERE city_name = ('$_POST[city]')";[/code]
(and a few variations of where to put the quote)
and
[code=php]$city = $_POST['city'];
$sql = "SELECT city_name, city_default_zi p, seatac_price, boeing_price FROM char_city WHERE city_name = ('$city')";[/code]
Plus: I pulled the following out of a book regarding the global variables....
foreach [code=php]($_POST as $key => $value) {
$$key = $value;
}[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
Watch. I'm missing some little punctuation mark or something -
Anybody see my problem?
Comment