Hello! I am trying to set up the following results:
My home page (html) has a list of several websites. Most of the content for each website listing is in HTML, and some of it is generated through PHP/MySQL based on the website’s index and query results.
There is a “Submit a Review” link next to each website that goes to another page which contains a form. The form has a select drop-down menu to choose which website URL to review, and the options are loaded, again, through PHP/MySQL based on the website’s index and query results.
What I want is when the link from my home page opens the new page containing the form, the form automatically loads the appropriate website URL based on the link from the home page. For now, it just opens with the form displaying “Choose One” (blank) on the Website URL drop-down select.
Here’s some of the code I have on the home page:
A list of browse categories:
<?php include("dbinfo.inc.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database");
$query=" SELECT * FROM MyListOfSites WHERE SiteID=‘1’";
$result = mysql_query($query);
$num=mysql_numrows($result);
if ($num==0) {
echo “No browse categories available.”;
} else {
$i=0;
while ($i < $num) {
$Browse1=mysql_result($result,$i,“Browse1”);
$Browse2=mysql_result($result,$i,“Browse2”);
$Browse3=mysql_result($result,$i,“Browse3”);
$Updated=mysql_result($result,$i,“Updated”);
echo "Browse Cateogory 1: $Browse1 ";
echo "Browse Cateogory 2: $Browse2 ";
echo "Browse Cateogory 3: $Browse3 ";
echo "Info Last Updated: $Updated ";
$i++;
}
}
mysql_close();
?>
A list of browse categories:
<?php include("dbinfo.inc.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database");
$query=" SELECT * FROM MyListOfSites WHERE SiteID=‘2’";
$result = mysql_query($query);
$num=mysql_numrows($result);
if ($num==0) {
echo “No browse categories available.”;
} else {
$i=0;
while ($i < $num) {
$Browse1=mysql_result($result,$i,“Browse1”);
$Browse2=mysql_result($result,$i,“Browse2”);
$Browse3=mysql_result($result,$i,“Browse3”);
$Updated=mysql_result($result,$i,“Updated”);
echo "Browse Cateogory 1: $Browse1 ";
echo "Browse Cateogory 2: $Browse2 ";
echo "Browse Cateogory 3: $Browse3 ";
echo "Info Last Updated: $Updated ";
$i++;
}
}
mysql_close();
?>
Here’s some of the code on my Submit Review page:
Name: | |
Email: | |
Website: | Choose One <?php include("dbinfo.inc.php"); mysql_connect($host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query=" SELECT * FROM MyListOfSites"; $result = mysql_query($query); $num=mysql_numrows($result); if ($num==0) { echo "No web sites available."; } else { $i=0; while ($i < $num) { $url=mysql_result($result,$i,"URL"); echo "$url"; $i++; } } mysql_close(); ?> |
Review: | |
And my form processing .php (that emails me the info they submitted on the review) is pretty standard, and everything works.
My conundrum remains: How to get the URL select to show the appropriate option (correlating to the URL of the website they want to review from the home page link) when the page is first loaded.
Please help!