Everyone!
In my admin area, of a small CMS, I am creating an admin home page, and an edit page.
In my admin home, the admin user, can see what pages exists on the site, by clicking an html drop down menu.
All pages are stored in mysgl database, so the site is completely dynamic, or going to be..
I have retrieved the name of the links, to show in the drop down menu by adding this code to the form
in the admin_home.php:
"<form action=\"../edit_page.php\" method=\"$_GET\">";
$result = mysqli_query ($myConnection, $query);
echo "<select class=\"boxstyles\" name='linklabel'><option>Choose A Page To Edit </option>";
// printing the list box select command
while($nt=mysqli_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[id]>$nt[linklabel]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
echo "<input type=\"submit\" name=\"formSubmit\" value=\"Go\">";
"</form>";
mysqli_free_result($result);
?>
What I want to happen is, when the admin have chosen a page from the list, and clicked the submit button, the page should redirect to: edit_page.php - but nothing happens, and I dont have a lot of experience in php, so I simply cant find out what i am doing wrong..
Also very important in what i want to happen: I want to prepopulate the form in the edit_page.php, with the existing data from the database. This is why I have tried to use the unique id from the mysql table, both in the dropdown menu, and in the edit_page.php. Somehow I think that is how I can get the form to display the relevant info after the page has been submitted, or??
The code below must have several error in it, and I hope someone can point them out to help me out here!
The code I have in edit_page.php looks like this:
if (isset($_GET['formSubmit'] == "Go")) {
// Query the body section for the proper page
include_once "connect_to_mysql.php";
$sqlCommand = "SELECT pagetitle, linklabel, heading, pagebody FROM pages WHERE id='$nt' LIMIT 1";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
while ($row = mysqli_fetch_array($query)) {
$pagetitle = $row["pagetitle"];
$linklabel = $row["linklabel"];
$heading = $row["heading"];
$pagebody = $row["pagebody"];
$pagebody = str_replace("<br />", "", $pagebody);
}
mysqli_free_result($query);
}
?>
Bottom line: After hitting the submit button, nothing happens at all....
Can someone assitst me in how I can achieve what I have tried to describe above?
I think is a i really user friendly way to let the admin choose which site to edit, and therefor I hope it can be implemented the right way!
Good night all, I am looking very much forward to get some assistance from you!
Klemme