JQuery and PHP display problem
- by TheCREATOR
I'm new to JQuery but for some reason I cant get the php code to display correctly when I put it in my JQuery script. The php code will display correctly when its not in the JQuery code can someone help me fix my JQuery code so it will display my PHP code correctly?
Here is the JQuery and PHP code.
var count = 0;
$(function(){
$('p#add_field').click(function(){
count += 1;
$('#container').append(
'<input type="text" name="sk" id="sk" />'
+ '<label for="exp">Exp: </label>'
+ '<?php'
+ 'echo \'<select id="exp" name="exp">\' . "\n";'
+ 'foreach($options as $option) {'
+ 'if ($option == $exp) {'
+ 'echo \'<option value="\' . stripslashes(htmlentities(strip_tags($option))) . \'" selected="selected">\' .'
+ ' stripslashes(htmlentities(strip_tags($option))) . \'</option>\' . "\n";'
+ '} else {'
+ 'echo \'<option value="\'. stripslashes(htmlentities(strip_tags($option))) . \'">\' .'
+ 'stripslashes(htmlentities(strip_tags($option))) . \'</option>\'."\n";'
+ '}'
+ '}'
+ 'echo \'</select>\';'
+ '?>'
+ '<label for="g">RGB: </label>'
+ '<?php'
+ 'echo \'<select id="g" name="g">\' . "\n";'
+ 'foreach($options as $option) {'
+ 'if ($option == $g) {'
+ 'echo \'<option value="\' . stripslashes(htmlentities(strip_tags($option))) . \'" selected="selected">\' .'
+ 'stripslashes(htmlentities(strip_tags($option))) . \'</option>\' . "\n";'
+ '} else {'
+ 'echo \'<option value="\'. stripslashes(htmlentities(strip_tags($option))) . \'">\' .'
+ 'stripslashes(htmlentities(strip_tags($option))) . \'</option>\'."\n";'
+ '}'
+ '}'
+ 'echo \'</select>\';'
+ '?></li>' );
});
});