PHP String issue with row[] SOLVED
Posted: Mon Jun 22, 2015 10:26 am
I have trying to pass the patient's id to a javascript function. The ids are coming from a Select-sql which is providing the correct names. However when I select a record it turns out that instead of the complete string being sent to the Javascript any strings with dashes (if they have numbers are being subtracted) and if they contain blanks they are being ignored.
In my code I have
If the patient id is '985-121' it returns '784'.
I've tried
Which gives me a
Which also generates a parse error
I've tried multiple variations and for the life of me I cannot figure out how to format that $row[patient_d] to send the correct string to the javascript function.
thank you
In my code I have
Code: Select all
<td width="100" align="center"><button type="button" onclick="listMedicallTreatments(<?php echo $row['patientl_id'];?>)">Get Treatments</button></td>
I've tried
Code: Select all
<td width="100" align="center"><button type="button" onclick="listMedicallTreatments(<?php echo $row[\'patientl_id'\];?>)">Get Treatments</button></td>And I've triedParse error: syntax error, unexpected ''patient_id\'];?>)">Get Treatme' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING)
Code: Select all
<td width="100" align="center"><button type="button" onclick="listAnimalTreatments(<?php echo $row['\patient_id\'];?>)">
I've tried multiple variations and for the life of me I cannot figure out how to format that $row[patient_d] to send the correct string to the javascript function.
thank you