Hey everyone!
After some research I have found that I need some javescript help to process a users click from a html drop down select list..
I am trying to create an admin area for a website in php and using mysql database.
In my admin home page, I have an option to choose a title on a page, from a dropdown select list. Which when clicked/chosen, should redirect to the edit_page.php..
My question is: When the admin have clicked a value from the select box, how do I redirect to the edit_page.php, where there is a form with the following fields:
- Page full title: Form here
- Linklabel: Form here
- Heading: Form here
- Body text: Form here
And I want to prepopulate the form fields so its easy to seee what to edit.
But I basically dont have any idea on how to get the data put into the form fields in edit_page.php.. I am new to PHP :-)
My code for the select dropdown is:
$query="SELECT id, linklabel FROM pages ORDER BY id ASC";
/* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */
'<form action=edit_page.php method=post>';
$result = mysqli_query ($myConnection, $query);
echo "<select class=\"boxstyles\" name='linklabel'>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
'</form>';
mysqli_free_result($result);
?>
In the database there is more than these two fields: ID, LINKLABEL - There is also: PAGETITLE, HEADING and BODYTEXT.
To prepopulate the edit_page.php form fields, do i need to include more than the: ID and LINKLABEL in the select box.
I hope this makes sence, and cleares my problem..