Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
thundarfoot
Regular
Regular



Joined: Jan 16, 2008
Posts: 75

PostPosted: Tue Jan 22, 2008 2:11 pm Reply with quote

I have php script that has a drop down select form which returns the user selection as a variable in a query to display records from a mysql table.

I want the dropdown form to be in a block and the output to show in main window.

Currently I have learned how to place my scrip inside a module and that works great...time to step it up a notch Smile

Any advice, would be most appreciated ty

Included the php code I am using currently.

Code:
//Database Class Connect

mysql_select_db($database_Lw, $Lw);
$query_Class = "SELECT `Class` FROM class_list ORDER BY id ASC";
$Class = mysql_query($query_Class, $Lw) or die(mysql_error());
$row_Class = mysql_fetch_assoc($Class);
$totalRows_Class = mysql_num_rows($Class);


//Database Cards Connect
$name = $_POST['select'];
mysql_select_db($database_Lw, $Lw);
$query_Cards = "SELECT Name, `Class`, Drops, Details FROM skill_cards WHERE skill_cards.`Class` LIKE '$name%' ORDER BY Name ASC";
$Cards = mysql_query($query_Cards, $Lw) or die(mysql_error());
$row_Cards = mysql_fetch_assoc($Cards);
$totalRows_Cards = mysql_num_rows($Cards);

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Loot Whore</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <label>Class
  <select name="select">
   <option value="">ALL</option>
    <?php
do { 
?>
    <option value="<?php echo $row_Class['Class']?>"><?php echo $row_Class['Class']?></option>
    <?php
} while ($row_Class = mysql_fetch_assoc($Class));
  $rows = mysql_num_rows($Class);
  if($rows > 0) {
      mysql_data_seek($Class, 0);
     $row_Class = mysql_fetch_assoc($Class);
  }
?>
  </select>
  </label>
<input type="submit" name="submit" value="submit">
</form>
<table border="1" cellpadding="5" cellspacing="5">
  <tr>
    <td>Name</td>
    <td>Class</td>
    <td>Drops</td>
    <td>Details</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Cards['Name']; ?></td>
      <td><?php echo $row_Cards['Class']; ?></td>
      <td><?php echo $row_Cards['Drops']; ?></td>
      <td><?php echo $row_Cards['Details']; ?></td>
    </tr>
    <?php } while ($row_Cards = mysql_fetch_assoc($Cards)); ?>
</table>
<br />
</body>
</html>
<?php
mysql_free_result($Class);

mysql_free_result($Cards);


CloseTable();
include_once 'footer.php';
?>
 
View user's profile Send private message
Gremmie
Former Moderator in Good Standing



Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Tue Jan 22, 2008 3:02 pm Reply with quote

Well, in a brief nutshell, you'll have to code up a form in a block, and have the post result (the "action") get directed to a module so the results can be displayed. See the PHP-Nuke How-To on what you need to do to code a block, and/or look at some of the supplied blocks.

_________________
Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module 
View user's profile Send private message
thundarfoot







PostPosted: Tue Jan 22, 2008 9:48 pm Reply with quote

I will admit I could not figure out how to work the content string into my script.
however using the editor I made a block by pasting the code. which works great!

But Where is this block saved I looked in the blocks directory thinking it would be named the name I gave it in the editor...but it was not.

so where is the file for it?

Thanks for all the help I have recived here.
 
Gremmie







PostPosted: Wed Jan 23, 2008 8:32 am Reply with quote

If you use the editor to make a block, the contents are stored in the database (I think in the _blocks table).
 
thundarfoot







PostPosted: Wed Jan 23, 2008 2:39 pm Reply with quote

Thank you
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©