freecrm
New Member
- Messages
- 629
- Reaction score
- 0
- Points
- 0
I have a recordset, based on a form submit which then echo's to a table - simple.
What I am trying to do is to have a checkbox to the left of each row (again simple)
At the base of the table, I would have a sperate blank row with fields and a link or button for "Edit all checked".
This would then update all records that have been checked with the values entered into the blank line.
The initial recordset is fine and displaying is fine. Even the checkbox is OK, but I'm having problems with the "value/ checked".
In addition, I already have a submit button for the initial recordset.
Current code below
HELP!!!!!
head stuff:
(. connection and db selection has already been made in an include)
body results etc...
What I am trying to do is to have a checkbox to the left of each row (again simple)
At the base of the table, I would have a sperate blank row with fields and a link or button for "Edit all checked".
This would then update all records that have been checked with the values entered into the blank line.
The initial recordset is fine and displaying is fine. Even the checkbox is OK, but I'm having problems with the "value/ checked".
In addition, I already have a submit button for the initial recordset.
Current code below
HELP!!!!!
head stuff:
(. connection and db selection has already been made in an include)
PHP:
<?php
//set form variable "search for what"
$crit1_recordlookup = "gobbledegook";
if (isset( $_POST['scriteria1'])) {
$crit1_recordlookup = (get_magic_quotes_gpc()) ? $_POST['scriteria1'] : addslashes( $_POST['scriteria1']);
}
//set form variable "search in which column"
$col1_recordlookup = "COMPANY";
if (isset( $_POST['scolumn1'])) {
$col1_recordlookup = (get_magic_quotes_gpc()) ? $_POST['scolumn1'] : addslashes( $_POST['scolumn1']);
}
//set form variable "order by"
$ord1_recordlookup = "COMPANY";
if (isset( $_POST['sorder'])) {
$ord1_recordlookup = (get_magic_quotes_gpc()) ? $_POST['sorder'] : addslashes( $_POST['sorder']);
}
$query_recordlookup = sprintf("SELECT * FROM CONTACTS WHERE %s LIKE '%%%s%%' ORDER BY %s", $col1_recordlookup,$crit1_recordlookup,$ord1_recordlookup);
$recordlookup = mysql_query($query_recordlookup ) or die(mysql_error());
$row_recordlookup = mysql_fetch_assoc($recordlookup);
$totalRows_recordlookup = mysql_num_rows($recordlookup);
?>
body results etc...
PHP:
<h1>Detailed Search</h1>
<fieldset>
<form name="form1" method="post" action="">
Find
<input name="scriteria1" type="text" id="scriteria1" value="<?php echo $_POST['scriteria1']?>" />
in
<select name="scolumn1" id="select3">
<option value="Some Option">Some Option</option>
<option value="Some Option">Some Option</option>
</select>
order by:
<select name="sorder" id="select5">
<option value="Some Option">Some Option</option>
<option value="Some Option">Some Option</option>
</select>
<input type="submit" name="Submit" value="Submit" />
</fieldset>
<p> <?php echo $totalRows_recordlookup ?> Records found </p>
<?php if ($totalRows_recordlookup > 0) { // Show if recordset not empty ?>
<table class="datatable" width="auto">
<tr class="trheader">
<td class="td1"> </td>
<td class="td1">Whatever1</td>
<td class="td1">Whatever2</td>
</tr>
<?php do { ?>
<tr>
<td class="td1">
<input name="checkbox" type="checkbox" id="checkbox" value="<?php echo $row_recordlookup['ID']; ?>" />
</td>
<td class="td1"><?php echo $row_recordlookup['Whatever1']; ?></td>
<td class="td1"><?php echo $row_recordlookup['Whatever2']; ?></td>
</tr>
<?php } while ($row_recordlookup = mysql_fetch_assoc($recordlookup)); ?>
<tr class="trheader">
<td class="td1">
<input name="update" type="submit" id="update" value="Edit checked with" />
</td>
<td class="td1">
<input name="whatever1" type="text" id="whatever" />
</td>
<td class="td1">
<input name="whatever2" type="text" id="whatever2" />
</td>
</tr>
</table>
<?php } // Show if recordset not empty ?>
</form>
<?php
mysql_free_result($recordlookup);
?>
Last edited: