rockinik
04-02-2010, 04:36 AM
Hey
My usageResult.php echos the $_POST('cat') and it doesnt work! Its just blank! I really cant understand why!!! PLEASE HELP!
Here is the usageForm.php.
Thanks SO SO SO SO MUCH!
<html>
<head>
<title>Usage Tracking</title>
<SCRIPT language=JavaScript>
function reload(form) {
var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location='UsageForm.php?cat=' + val ;
}
</SCRIPT>
</head>
<body>
<h2>Usage Tracking</h2>
<form action="UsageResult.php" method="post">
Category :
<select name="cat" onchange="reload(this.form)">
<option value="">-- All --</option>
<?php
$cat=$_GET['cat'];
$connect = mysql_connect('localhost', 'root', '');
if(!$connect) {
die('Could not connect: '.mysql_error());
}
mysql_select_db('phase3');
$result = mysql_query('
Select distinct description
from category
');
while($row = mysql_fetch_row($result)) {
print "<option value = \"$row[0]\" > $row[0] </option>";
}
mysql_close($connect);
?>
</select>
</br>
News Title :
<select name="newsTitle">
<?php
$connect = mysql_connect('localhost', 'root', '');
if(!$connect) {
die('Could not connect: '.mysql_error());
}
mysql_select_db('phase3');
if(!isset($cat)) {
$result = mysql_query("
Select distinct title
from news_article
");
} else {
$result = mysql_query("
select na.title
from news_article na,category c
where na.news_id = c.highlight_news_id
and c.description = '$cat'
union
select na.title
from news_article na,news_category nc,category c
where na.news_id = nc.news_id
and nc.category_id = c.category_id
and c.description = '$cat'
");
}
while($row = mysql_fetch_row($result)) {
print "<option value = \"$row[0]\" > $row[0] </option>";
}
mysql_close($connect);
?>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
My usageResult.php echos the $_POST('cat') and it doesnt work! Its just blank! I really cant understand why!!! PLEASE HELP!
Here is the usageForm.php.
Thanks SO SO SO SO MUCH!
<html>
<head>
<title>Usage Tracking</title>
<SCRIPT language=JavaScript>
function reload(form) {
var val=form.cat.options[form.cat.options.selectedIndex].value;
self.location='UsageForm.php?cat=' + val ;
}
</SCRIPT>
</head>
<body>
<h2>Usage Tracking</h2>
<form action="UsageResult.php" method="post">
Category :
<select name="cat" onchange="reload(this.form)">
<option value="">-- All --</option>
<?php
$cat=$_GET['cat'];
$connect = mysql_connect('localhost', 'root', '');
if(!$connect) {
die('Could not connect: '.mysql_error());
}
mysql_select_db('phase3');
$result = mysql_query('
Select distinct description
from category
');
while($row = mysql_fetch_row($result)) {
print "<option value = \"$row[0]\" > $row[0] </option>";
}
mysql_close($connect);
?>
</select>
</br>
News Title :
<select name="newsTitle">
<?php
$connect = mysql_connect('localhost', 'root', '');
if(!$connect) {
die('Could not connect: '.mysql_error());
}
mysql_select_db('phase3');
if(!isset($cat)) {
$result = mysql_query("
Select distinct title
from news_article
");
} else {
$result = mysql_query("
select na.title
from news_article na,category c
where na.news_id = c.highlight_news_id
and c.description = '$cat'
union
select na.title
from news_article na,news_category nc,category c
where na.news_id = nc.news_id
and nc.category_id = c.category_id
and c.description = '$cat'
");
}
while($row = mysql_fetch_row($result)) {
print "<option value = \"$row[0]\" > $row[0] </option>";
}
mysql_close($connect);
?>
<input type="submit" value="Submit"/>
</form>
</body>
</html>