On the homepage.php I have a dropdown which pulls all page names with submit button.
when submit button is pressed, I want the page link corresponding to the selected page name from sql to pop up as a link . This is the code I came up with, BUT nothing is happening. where am i wrong?
<?php
$conn = mysqli_connect('localhost', 'dc', 'bn', 'dbh');
if (!$conn) {
die('Could not connect: ' . mysqli_error());
}
$page = $_POST['page_name'];
// inserts value into the sql table
$sql = "SELECT page_link FROM pages WHERE page_name = '$page'";
$result = mysqli_query($conn, $sql);
if ($row = mysqli_fetch_array($result)) {
//drop down options from sql table
echo '<a href = "'. $row['page_link'] . '" > </a> ';
}
mysqli_close($conn);
?>
This post has been edited by rosepetalpowder: 03 April 2012 - 04:09 PM

New Topic/Question
Reply



MultiQuote






|