Hi!
This is my first post at these boardsand i want to start off with something easy for you guys.
I've got this modified postnuke site going and i just added a new link/bookmark section. It connects and reads the database tables ok, but when a user tries to add a bookmark to the database, it doesn't submit the info in the form to the database. All that happens is that i get redirrected to my main index page...
The linkpage is located at:http://www.vinyamar.com/~wotforums/clancms/?mid=7
and the index file that handles the form looks like this:
<?
if (isset($submitbookmark)) {
include("common.php");
mysql_connect($hostname,$username,$passwrd) OR DIE("Oh twadi! Couldnt connect to the database, sorry mate!");
@mysql_select_db($dbname) or die( "Unable to select database");
$query3 = "INSERT INTO $tablename VALUES (NULL, '$folder','$linkname','$linkurl','$approved')";
$result3 = mysql_query($query3);
}
?>
<head>
<link rel="StyleSheet" href="../links.css" type="TEXT/CSS">
</head>
<body bgcolor="#CCCCCC">
<table align=center cellspacing=10 width=100% border="0">
<tr>
<td valign="top" width="60%"><strong class="black-header"><u>The Links</u></strong><br><br>
<?
include("common.php");
mysql_connect($hostname,$username,$passwrd) OR DIE("Oh twadi! Couldnt connect to the database, sorry mate!");
@mysql_select_db($dbname) or die( "Unable to select database");
$query2 = "SELECT folder, linkname, linkurl FROM $tablename WHERE approved='yes' ORDER BY folder";
$result2 = mysql_query($query2) or die ("<strong class=black>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:sandeep@wde.org>me</a> and told me!</strong>");
if ($result2) {
while ($r2 = mysql_fetch_array($result2)) {
extract($r2);
$linkname = ($linkname);
if ( $folder != $folder_previous) {
echo "<strong class=black>» </strong> <strong class=black-small>$folder</strong><br>";
}
echo " <strong class=black>-</strong> <small class=black-small><a href=$linkurl target=\"_blank\">$linkname</a></small><br>";
$folder_previous = $folder;
}
echo "</td>";
mysql_free_result($result2);
}
unset($linkname);
unset($linkurl);
unset($folder);
echo "<td valign=top width=40%>";
if (isset($submitbookmark)) {
echo "<small class=black>Your link has been sent to the database. It'll show up here when it's been cleared by the Admin.<br><br> Want to add a link?, Klick <a href=\"$page\">HERE</a> </small><br><br>";
}
else {
echo "<form action=\"$page\" method=post><input type=\"hidden\" name=\"approved\" value=\"no\">
<strong class=black-header><u>Add Link!</u></strong><br><br>";
mysql_connect($hostname,$username,$passwrd) OR DIE("Oh twadi! Couldnt connect to the database, sorry mate!");
@mysql_select_db($dbname) or die( "Unable to select database");
$query4 = "SELECT folder FROM $tablename GROUP BY folder";
$result4 = mysql_query($query4) or die("<strong class=black>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:$webmaster>me</a> and told me!</strong>");
if ($result4) {
echo "<table cellpadding=0 cellspacing=0><tr><td>Category:</td><td><select name=\"folder\"><option>";
while ($r4 = mysql_fetch_array($result4)) {
extract($r4);
echo "
<option value=\"$folder\">$folder";
}
echo "</select>";
mysql_free_result($result4);
}
echo " </td></tr>
<tr><td>Link Name:</td> <td><input type=text name=\"linkname\" class=normal value=$linkname></td></tr>
<tr><td>Adress:</td> <td><input type=text name=\"linkurl\" class=normal value=\"http://\"></td></tr>
<tr><td colspan=2 align=center><input type=\"submit\" name=\"submitbookmark\" value=\"submit bookmark\"></td></tr> </table>
</form><br>";
}
mysql_connect($hostname,$username,$passwrd) OR DIE("Oh twadi! Couldnt connect to the database, sorry mate!");
@mysql_select_db($dbname) or die( "Unable to select database");
$query1 = "SELECT * FROM $tablename WHERE approved='yes' ORDER BY id DESC LIMIT 10";
$result1 = mysql_query($query1) or die ("<strong class=black>Whoops! Something wrong happened to the my database! It would be nice if you emailed <a href=mailto:$webmaster>me</a> and told me!</strong>");
if ($result1) {
echo "<strong class=black-header><u>Last 10 links.</u></strong><br>";
while ($r1 = mysql_fetch_array($result1)) {
extract($r1);
$linkname = ($linkname);
echo " <strong class=black-large>»</strong> <strong class=black-small><a href=$linkurl target=\"_blank\">$linkname</a></strong><br>";
}
echo "</td>";
mysql_free_result($result1);
}
echo "</table>";
?>
</body>
Thank you for the help...
AnthiStatic