Adding Admin section for New Module

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Adding Admin section for New Module
ringo380
CZ Newbie
ringo380 has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Jul 21, 2004
0.00 posts per day
Posts: 2
Points: 154
   
I'm new to PHP/mySQL. I couldn't find any existing modules that would simply display certain fields from a database, simple as it seems, so I studied the php.net manual and made one. It works perfectly now, but I want to add an admin section so that employees that are going to be using this will be able to add items to the database without having to go through the trouble of logging in to phpMyAdmin.

I've written up the form code and gotten it working, surprisingly, but now I just need to figure out how to make it display in the administration area. I'll post the code here. I've had a PHPNuke site hacked recently, so I'm not sure which information is "sensitive", so I'm going to block the SQL queries and information, hopefully nothing necessary to understand it with. There's also probably alot of pointless stuff. I was attempting to do something a little more complex and flexible with the code previously, but was unsuccesful:


<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Size: <input type="text" name="input[1]">
<br> Dimensions: <input type="text" name="input[2]">
<br> Basis Weight: <input type="text" name="input[3]">
<br> Print Capability: <input type="text" name="input[4]">
<br> Bundle/Bale Pack: <input type="text" name="input[5]">
<br> Bundle/Bale Weight Lbs.: <input type="text" name="input[6]">
<br> Bundle/Bale Cube: <input type="text" name="input[7]">
<br> Bundle/Bale per Layer: <input type="text" name="input[8]">
<br> Bundle/Bale per Pallet: <input type="text" name="input[9]">
<br> Pallet Weight: <input type="text" name="input[10]"><br>
<input type="submit" name="submit" value="Submit"> </form> 

<?php 

global $i, $current_cat, $results; 

$dbhost = "******";
$dbname = "******";
$dbuser = "******";
$dbpw = "******"; 

mysql_connect($dbhost, $dbuser, $dbpw);
mysql_select_db($dbname); 

$current_cat = array(1 => "****", 2 => "dim", 3 => "****", 4 => "****", 5 => "****", 6 => "****", 7 => "****", 8 => "****", 9 => "****", 10 => "****"); 

$results = $_POST["$input"]; print_r($results);
$i = 1; $results;  if (!$input) {    echo " ";
}    else {    
   $query = "INSERT INTO GroceryBags (".$current_cat[1].",".$current_cat[2].",".$current_cat[3].",".$current_cat[4].",".$current_cat[5].",".$current_cat[6].",".$current_cat[7].",".$current_cat[8].",".$current_cat[9].",".$current_cat[10].") VALUES ('".$input[1]."','".$input[2]."','".$input[3]."','".$input[4]."','".$input[5]."','".$input[6]."','".$input[7]."','".$input[8]."','".$input[9]."','".$input[10]."')";    

$sql_exec = mysql_query($query);    
$sql_exec;    
echo $query . "\n<br>\n";   
}



If anyone can figure out how to make the above into an admin section, it would be much appreciated. Thanks.


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum