0

I seem to get an error trying to create a dynamic checkbox connecting with an ORACLE database. (Parse error: syntax error, unexpected 'checkbox' (T_STRING), expecting ',' or ';' in C:\xampp\htdocs\phptest.php on line 13 )

Also, is there a way for me to get the index of the selected check box to edit the data lat on? Any suggestions would be helpful :)

<?php
$conn = oci_connect('DBadmin', 'dbadmin', 'PETLOVERSDB');
if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
} 
            $query= 'select PET_RACE_NAME from petrace';
            $stmt = oci_parse($conn, $query);
            oci_execute($stmt); 


                while($row=oci_fetch_assoc($stmt)) {                
                     echo "<input type = "checkbox" value = "[PET_RACE_NAME]" />"  ; 
                }                

 ?>  
MMYW
  • 67
  • 1
  • 7

1 Answers1

0

You need to either escape your double quotes around checkbox & [PET_RACE_NAME] -

echo "<input type = \"checkbox\" value = \"{$row['PET_RACE_NAME']}\" />"  ; 

or use single quotes

echo "<input type = 'checkbox' value = '{$row['PET_RACE_NAME']}' />"  ; 
Sean
  • 12,439
  • 3
  • 27
  • 46