Forgive the title, this is the best way I can think to word my issue.
Basically, I have a html form inside some php code, but I need to include javascript functions (with parameters specified) inside the form. But I have an issue with the single and double quote marks escping the php code. See below:
echo'<form id="create_booking_form" onsubmit="return false;">
<div>Student Name: </div>
<input id="students_name" type="text" onfocus="emptyElement('status')" onkeyup="restrict('students_name')" maxlength="30">
<div>Parents Name: </div>
<input id="parents_name" type="text" onfocus="emptyElement('status')" onkeyup="restrict('parents_name')" maxlength="30">
<div>Parents Email Address: </div>
<input id="parents_email" type="text" onfocus="emptyElement('status')" onkeyup="restrict('parents_email')" maxlength="100">
<div>Booking Time: </div>
<input id="booking_time" type="text" onfocus="emptyElement('status')" onkeyup="restrict('booking_time')" maxlength="8">
<div>Comments / Questions: (max 255 characters)</div>
<input id="comments" type="text" onfocus="emptyElement('status')" onkeyup="restrict('comments')" maxlength="255">
<div>Password: </div>
<input id="password" type="password" maxlength="16">
<br /><br />
<button id="createbookingbtn" onclick="createbooking()">Submit your booking</button>
<span id="status"></span>
</form>
</div>
</div>';?>
My issue is for example: onkeyup="restrict('students_name')"
If i use single quote to specify 'student_name' it escapes the echo command form the php code. If i use double quotes it escapes the restrict() function...
What can I do?
Much appreciated
Is anyone able to help me out here?