The file admin / modules / horoscope.php contains code to manage the administrative module. This code is to display the entire page, including the menu for access to administrative functions, and call other functions. The functions involved in a case to display the form, and in the case to save the horoscope changed.
Code:
global $ hlpfile, $ admin, $ prefix, $ language, $ multilingual;
include ("header.php");
GraphicAdmin ("manual / horoscope.html");
OpenTable ();
switch ($ op) {
case "savehoroscope": save (); break;
default: form (); break;
}
CloseTable ();
include ("footer.php");
The function that displays the form is:
form function () {
$ Q = mysql_query ("select sign, horoscope forecasts from order by order");
echo "<h1 align='center'> Weather </ h1> \ n";
echo "<table border='1' width='100%'>";
while (list ($ sign, $ forecast) = mysql_fetch_row ($ q)) {
echo "<form method='GET' action='admin.php'>";
echo "<input type='hidden' name='op' value='savehoroscope'>";
echo "<input type='hidden' name='sign' value='$sign'>";
echo "<tr> <td valign='middle'> $ sign </ td>";
echo "<td> <textarea name='forecast' rows='1' cols='60'> $ forecast </ textarea> </ td>";
echo "<input <td> type='submit' value='Save'> </ td> \ n";
echo "</ form> </ tr>";
}
}
As you can see, they are manufactured as varied as horoscopes, and each is composed of a URL with hidden fields. Thanks to this, by pressing the Save button invokes the administrative module set with the rescue operation and the necessary parameters. Finally, the function that saves a horoscope is amended:
Code:
function save () {
global $ sign, $ forecast;
if (mysql_query (
"Update September horoscope forecasts = '$ forecast' where symbol = '$ sign'"))
{
echo "$ <h1> Horoscope for sign saved. </ h1>";
Else {}
echo "Error saving <h1> </ h1>";
}
}
Bookmarks