I can't get my Add new Division form to submit to the database. Anyone see my issue?
Code: <?php
$e = <<<here
<script src="./jscripts/scriptaculous/prototype.js" type="text/javascript"></script>
<script src="./jscripts/scriptaculous/scriptaculous.js" type="text/javascript"></script>
<script type="text/javascript" src="./jscripts/ajax.js"></script>
here;
switch ($_REQUEST['option']) {
case 0:
echo $e;
?>
<h1 class="backstage">Division Management</h1><br />
<h2 class=backstage>Divisions :: <a href="#" onclick="ajaxpage('backstage_libs/division.php?option=1', 'content'); return false;">Add New</a></h2><br />
<table width="100%" class="table1">
<tr class="rowheading">
<td> </td>
<td>Name</td>
</tr>
<?php
$query = "SELECT * FROM efed_list_divisions";
$result = mysql_query ( $query );
$rows = mysql_num_rows($result);
if ($result) {
$i = 0;
while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
$sClass = 'row2';
if ($i++ % 2) $sClass = 'row1';
printf ( "<tr class="%s">", $sClass );
print "<td valign="top" align=center width=35><a href="#" onclick="ajaxpage('backstage_libs/division.php?option=2', 'content'); return false;">Edit</a></td>";
printf ( "<td valign="top">%s</td>", $row [name] );
echo '</tr>';
}
echo '</table>';
} else {
echo '<span>There are no divisions.</span><br />';
}
returnmain();
break;
case 1:
echo $e;
require_once('../backstagefunctions.php');
?>
<h1 class="backstage">Division Management</h1><br />
<h2 class="backstage">Add New Division</h2><br />
<form name="divisions" method="post">
<input type="hidden" name="action" value="division" />
<table width="100%" class="table2">
<tr>
<td width="120" class="rowheading" valign="center">Division Name:</td><td class="row3"><input type="text" name="name" class="fieldtext490"></td>
</tr>
</table><br />
<input type="hidden" name="newadded" value="true">
<input type="submit" value="Save Division" class="button"></form><br />
<form method="post"><input type="submit" value="Return to Division List" class="button200" name="return">
</form><br />
<?php
returnmain();
break;
case 2:
echo $e;
require_once('../backstagefunctions.php');
?>
<h1 class="backstage">Division Management</h1><br />
<h2 class="backstage">Edit Division</h2><br />
<form name="editdivision" method="post">
<table width="100%" class="table2">
<tr>
<td width="120" class="rowheading" valign="center">Division:</td><td class="row3"><input type="text" name="division" class="fieldtext490" value=""></td>
</tr>
</table><br />
<center>
<input type="checkbox" name="deletedivision"><span class="table1heading">Delete Division?</span><br /><br />
<input type="submit" value="Edit Division" class=button name="editdivision"><br /><br />
<input type="button" value="Return to Divisions List" class="button200"><br /><br />
</form>
<?php
returnmain();
break;
}
function division() {
if ((!empty($_POST['newadded'])) && (!empty($_POST['divisions']))) {
$name = mysql_real_escape_string($_POST['name']);
$query = "INSERT INTO `efed_list_divisions` (name) VALUES ('".$name."')";
if (mysql_query($query)) {
//success
} else {
//fail
}
}
}
?>
Validating time
Hi Guyswhat do you think of the following approach to validate a 24hour time:http://snipplr.com/view/23007/validate-time/Are there any better approaches ?
upgrade from 4.7 to ECC 6.0
Hi all,
Target costs on Process orders not calculating
Hi All,
Stats of viewers
Hello. I have a website in php and people can login. I want to make an admin control panel where u can see how many people are currently logged in and also how many people in total (including the ones
Schedule editor
Hi,
Multidimensional Array into an Html table, help!
Hello all, I am new to HTML/PHP so any help would be great.I have a multidimensional array filled with values that I am trying to output into an html table. This works (outputs value of array):Code:
Taylor Series Function
So I am working a a project for my intro C++ class, and I am having some trouble with a function for approximating exp(x) using a taylor series. The taylor series approximations for exp(x) is:
DELETE FROM not working deletes wrong row
HelloI have the following code which i found but it doesnt work properly.. it comes up with a list of the items in the database e.g.item 1 - deleteitem 2 - delete item 3 - deletebut when i
Save data in input fields when they press "BACK BUTTON"
Hi, this is html form: And let's say they get a error "Please enter ur title must be more then 3 character" then they click the BACK BUTTON AND ALL THERE DATA IS GONE!!How i fix?Code:
Extracting URL pointer within XML tag
Hi.I'm trying to extract text between two quotation marks in XML. For example, I want to extract:<a href="www.thisisanexample.com">Click here</a>. I want to