Click to See Complete Forum and Search --> : html, php, checkboxes urgent thanks


Lusty
01-04-2008, 03:16 AM
hi i have a few problems which i need help with urgently
I'm creating a web page for the user to select from a list of items using checkboxes and after clicking the submit button the web will search the database and display in a table format.
1. i need help with checking if the check box is selected after the submit button is clicked
2. should i create a seprate php file for every single check box select statement to do the selection of data?(ex. calling the php by using form action)
3.any one knows how i can host a page and be able to access it from another computer in the same network using apache?

this is my code so far for the check boxes if you i'd loved to hear from you your views or any errors i'm having in the code


<fieldset id="selection">
<legend>Select the information for viewing</legend>

<div>
<p>
<input type="checkbox" name="selection[]" value="COMPUTER" id = "COMPUTER"
<?php
$OK = isset($_POST['selection']) ? true : false;
if ($OK && isset(missing) && in_array('COMPUTER',
$_POST['selection']))
?>
<label for="COMPUTER"><B>COMPUTER</B></label>
</p>

<p>
<input type="checkbox" name="selection[]" value="UTMP" id = "UTMP"
<?php
$OK = isset($_POST['selection']) ? true : false;
if ($OK && isset(missing) && in_array('UTMP',
$_POST['selection']))
?>
<label for="UTMP"><B>UTMP</B></label>
</p>


<p>
<input type="checkbox" name="selection[]" value="PASSWD_WRITE" id = "PASSWD_WRITE"
<?php
$OK = isset($_POST['selection']) ? true : false;
if ($OK && isset(missing) && in_array('PASSWD_WRITE',
$_POST['selection']))
?>
<label for="PASSWD_WRITE"><B>PASSWD_WRITE</B></label>
</p>


<p>
<input type="checkbox" name="selection[]" value="DEFAULT_PATH" id = "DEFAULT_PATH"
<?php
$OK = isset($_POST['selection']) ? true : false;
if ($OK && isset(missing) && in_array('DEFAULT_PATH',
$_POST['selection']))
?>
<label for="DEFAULT_PATH"><B>DEFAULT_PATH</B></label>
</p>


<p>
<input type="checkbox" name="selection[]" value="REVIEW_ACCESS" id = "REVIEW_ACCESS"
<?php
$OK = isset($_POST['selection']) ? true : false;
if ($OK && isset(missing) && in_array('REVIEW_ACCESS',
$_POST['selection']))
?>
<label for="REVIEW_ACCESS"><B>REVIEW_ACCESS</B></label>
</p>


<p>
<input type="checkbox" name="selection[]" value="FILE_PERMISSION" id = "FILE_PERMISSION"
<?php
$OK = isset($_POST['selection']) ? true : false;
if ($OK && isset(missing) && in_array('FILE_PERMISSION',
$_POST['selection']))
?>
<label for="FILE_PERMISSION"><B>FILE_PERMISSION</B></label>
</p>


<p>
<input type="checkbox" name="selection[]" value="PASSWD_CTRL" id = "PASSWD_CTRL"
<?php
$OK = isset($_POST['selection']) ? true : false;
if ($OK && isset(missing) && in_array('PASSWD_CTRL',
$_POST['selection']))
?>
<label for="PASSWD_CTRL"><B>PASSWD_CTRL</B></label>
</p>

<p>
<input type="checkbox" name="selection[]" value="OPEN_DIR" id = "OPEN_DIR"
<?php
$OK = isset($_POST['selection']) ? true : false;
if ($OK && isset(missing) && in_array('OPEN_DIR',
$_POST['selection']))
?>
<label for="OPEN_DIR"><B>OPEN_DIR</B></label>
</p>

</form>
<form name="form8" method="post" action="">
<input type="submit" name="Submit" value="Submit">
</form>
</div>

</fieldset>

ray326
01-04-2008, 01:15 PM
1-2 I'd recommend you NOT use the "selection[]" technique and make the names the same as the IDs.

3 It's pretty trivial. Install Apache. Put your page in the htdocs directory.

Lusty
01-14-2008, 02:28 AM
<p>
<input type="checkbox" name="COMPUTER" value="COMPUTER" id = "COMPUTER"
<?php
if (value = COMPUTER)
{
echo '$Test.php';
}
?>
<label for="COMPUTER"><B>COMPUTER</B></label>
</p>

another question is this how you check if a checkbox is checked?

ray326
01-14-2008, 12:36 PM
if (getElementById("COMPUTER").checked) { ... }

Lusty
01-14-2008, 12:48 PM
hey thanks a million maybe you could leave ur msn or smt soo i can ask u more questions i have tons of things i have yet to understand which i need help with about creating dynamic webpage

ray326
01-14-2008, 03:34 PM
You'll find great support here in the PHP and Javascript forums.

Lusty
01-15-2008, 02:25 AM
could i grab ur contact like ur msn? soo i can ask things faster?

ray326
01-15-2008, 10:38 PM
Nope for two reasons. I don't do MSN and I answer questions here for the (potential) benefit of all readers.

Lusty
01-16-2008, 03:47 AM
its ok by the way i'm having a problem i wanna check cause i hit an error with this code is it possible to verify what is wrong with the code

if ($selection[i]=="UTMP") {
echo
"<table width="400" border="1" cellspacing="0" cellpadding="0">
<tr>
<th>UTMP</th>"
foreach ($Selection as $query)
{
echo "<th> \ $query \ </th>"
}
echo "<th>
</tr>";

ray326
01-16-2008, 12:56 PM
I'd post that in the appropriate language (PHP?) forum.

Lusty
01-16-2008, 02:11 PM
sorry i repost it again yea its in php could you tell me if the forloop is implementable aft my sql query and when i create the tables for indivudual tables

<?php
if(isset($_POST['Submit']))
{
include("dbinfo.inc.php");

$table = array($Selection);
$Selection = $_POST['Selection'];
$UTMP = $_POST['UTMP'];
$PASSWORD_WRITEABLE_PERMISSION = $_POST['PASSWORD_WRITEABLE_PERMISSION'];
$DEFAULT_PATH = $_POST['DEFAULT_PATH'];
$USER_ACCESS = $_POST['USER_ACCESS'];
$FILE_PERMISSION = $_POST['FILE_PERMISSION'];
$PASSWORD_CONTROL = $_POST['PASSWORD_CONTROLl'];
$USER_ACCESS = $_POST['USER_ACCESS'];

$query = "SELECT * FROM $table WHERE COM_IP = $Com_ip";
mysql_query($query) or die ('Error, Select query failed');

mysql_close();

if ($selection[i]=="UTMP") {

echo "<table width="400" border="1" cellspacing="0" cellpadding="0">
<tr>
<th>UTMP</th>
foreach ($Selection as $query)
{
echo <th> \ $query \ </th>
}
</tr>"