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,443
  • 3
  • 29
  • 47
  • That solved the error but now I seem to have the checkboxes but the name don't appear. There are 5 checkboxes side by side. How can i fix that problem? – MMYW Apr 19 '15 at 21:00
  • the name of the checkbox `Pet_Race_Name – Sean Apr 19 '15 at 21:03