Thank you both. What I'm trying to do actually is output $course_block (which has many lines of text that includes apostophes, which are the problem) inside a javascript block. Here's the javascript:
<script type="text/javascript">
var count = 0;
$(function() {
$('p#add_field').click(function() {
count += 1;
$('#container').append('<select id="field_' + count + '" name="fields[]' + '"> <?php echo htmlspecialchars($course_block, ENT_QUOTES); ?> </select>');
});
});
</script>
As you can see, I tried using htmlspecialchars() to output the data and while it DID allow me to create the <SELECT> block when the function was run it didn't show any data inside. Assuming the code that populate $course_block works (which it does), what else could be the problem? Here's the code for $course_block just so you have it:
$sql = "SELECT title, subject, coursenum, section, crn, instructor, credits, price FROM catalog ORDER BY subject,coursenum";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$subject = $row['subject'];
$coursenum = $row['coursenum'];
$section = $row['section'];
$crn = $row['crn'];
$title = $row['title'];
$instructor = $row['instructor'];
$credits = $row['credits'];
$price = $row['price'];
$course_block .= "<option value=\"$subject-$coursenum-$section-$crn-$title-$instructor-$credits-$price\">$subject $coursenum- $title- Instructor: $instructor- Section: $section- Credits: $credits- Price: \$$price</option>";
}