Forum Moderators: open
<?php
{
print "<script src=\"/jscripts/scriptaculous/prototype.js\" type=\"text/javascript\"></script>\n";
print "<script src=\"/jscripts/scriptaculous/scriptaculous.js\" type=\"text/javascript\"></script>\n";
print "<script type=\"text/javascript\" src=\"./jscripts/ajax.js\"></script>\n";
}
?><?php
$option = $_GET['option'];
if ($option == 0 )
{
print '<h1 class="backstage">Match Type Management</h1><br />';
print "<h2 class=backstage>Match Types :: <a href=\"#\" onclick=\"ajaxpage('backstage_libs/matchtypes.php?option=1', 'content'); return false;\">Add New</a></h2><br />";
print '<table width="100%" class="table1">';
print '<tr class="rowheading">';
print '<td> </td>';
print '<td>Name</td>';
print '</tr>';
$query = "SELECT * FROM efed_list_matchtypes";
$result = mysql_query ( $query );
if ($result)
{
$i = 0;
while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) )
{
$sClass = 'row2';
if ($i ++ & 1)
{
$sClass = 'row1';
}
printf ( "<tr class=\"%s\">", $sClass );
print "<td valign=\"top\" align=center width=35><a href=\"#\" onclick=\"ajaxpage('backstage_libs/matchtypes.php?option=2', 'content'); return false;\">Edit</a></td>";
printf ( "<td valign=\"top\">%s</td>", $row [matchtype] );
print '</tr>';
}
print '</table>';
}else
{
print '<span>There are no match types.</span><br />';
}
print '<br />';
returnmain();
} elseif ( $option == 1)
{
include('../backstageconfig.php');
include('../backstagefunctions.php');
print '<h1 class="backstage">Match Type Management</h1><br />';
print '<h2 class="backstage">Add New Match Type</h2><br />';
print '<form name="addmatchtype" method="post" action="backstage.php">';
print '<table width="100%" class="table2">';
print '<tr>';
print '<td width="120" class="rowheading" valign="center">Match Type:</td><td class="row3"><input type="text" name="matchtype" class="fieldtext490"></td>';
print '</tr>';
print '</table><br />';
print '<input type="submit" value="Save Match Type" class="button" name="submit"></form><br />';
print '<form method="POST"><input type="submit" value="Return to Match Type List" class="button200"></form><br />';
returnmain();
} elseif ( $option == 2)
{
include('../backstageconfig.php');
include('../backstagefunctions.php');
print '<h1 class="backstage">Match Type Management</h1><br />';
print '<h2 class="backstage">Edit Match Type</h2><br />';
print '<form name="editmatchtype" method="post" action="backstage.php">';
print '<table width="100%" class="table2">';
print '<tr>';
print "<td width=\"120\" class=\"rowheading\" valign=\"center\">Match Type:</td><td class=\"row3\"><input type=\"text\" name=\"matchtype\" class=\"fieldtext490\" value=\"".$row['matchtype']."\"></td>";
print '</tr>';
print '</table><br />';
print '<input type="checkbox" name="deletematchtype"><span class="table1heading">Delete Match Type?</span><br /><br />';
print '<input type="submit" value="Edit Match Type" class=button name="editmatchtype"><br /><br />';
print '<input type="button" value="Return to Match Type List" class="button200"><br /><br />';
returnmain();
}
?>
<?php
if (isset ($_POST['submit']))
{
$matchtype = $_POST['matchtype'];
$query = "INSERT INTO efed_list_matchtypes (matchtypes) VALUES ('$matchtype')";
if (@mysql_query ($query))
{
print '<p>The match type has been added.</p>';
} else
{
print '<p>Could not add the entry because: <b>" . mysql_error() . "</b>. The query was $query.</p>';
}
}
?>
2) What output are you getting, assuming 1) was not the problem?
"The match type has been added."
or
"Could not add the entry because: ... The query was ..."?
If there is a SQL exception being thrown it appears that your code should display the error -- if so, what is that error message.
3) This probably won't fix your problem, but you should format your <input ...> tags like <input ... />
2. I'm not getting any error message all it does is loads the same backstage.php file that is in the form action tag.