I have a Table A with thousands of records. On each displayed page, only 20 rows are showing, with the following fields:
check
last_name
first_name
gr
eth
sex
id_num (a unique value)
reason
start_date
$html = <input type='checkbox' name='checkbox[]'
id = '' value='<?PHP echo $aRecords [ \"id_num\" ]; ?>' />" ;
include_once "db_login.php" ;
if ( isset ( $_POST [ checkbox] ) )
{
foreach ( $_POST [ 'checkbox' ] as $checkbox )
{
$sql = "INSERT INTO sap_id_select ( select_id )
VALUES ( '<???>' ) " ;
mysql_query ( $sql ) or ( "Error " . mysql_error () ) ;
}
}
foreach ( $_POST [ 'checkbox' ] as $checkbox )
{
$id_list = implode(',',$_POST['checkbox']);
$sql = "INSERT INTO sap_id_select ( select_id )
VALUES ( '{$id_list}' ) " ;
}
$_POST
$html = <input type='checkbox' name='checkbox[]'
id = '' value='<?PHP echo $aRecords [ \"id_num\" ]; ?>' />" ;
You're missing the open quote aren't you? So the above doesn't give you an error that means your opening quote is above this line in other words, it's all messed up. Use an editor that colors your syntax.
Assuming you wanted to write
$html = "<input type='checkbox' name='checkbox[]'
id = '' value='<?PHP echo $aRecords [ \"id_num\" ]; ?>' />" ;
then php will interpret the <?PHP bit litterally, which would explain what you're seeing. You want simply:
$html = "<input type='checkbox' name='checkbox[]'
id = '' value='".$aRecords["id_num"]."' />" ;
Or is what you wrote is not in the php excuted part of your code then all I can suggest is to put <?php instead of <?PHP but I doubt very much it's what's causing problems. My bet is on the above.