Hi,
I need to use PHP inside html

print '
<html>
-----part
<select name="speriod">
<option value='<?php $cval ?> print '>'<?php echo $cval ?> print '</option>
</select>
</html>'


I don't know to add PHP inside html tag. Facing Parser Error

Recommended Answers

Change your code as,

<select name="speriod">
<option value='<?php echo $cval; ?> print '>'<?php echo $cval ; ?> print '</option>
</select>
Jump to Post

All 3 Replies

Change your code as,

<select name="speriod">
<option value='<?php echo $cval; ?> print '>'<?php echo $cval ; ?> print '</option>
</select>

Html in php

<?php
	print '<select name="speriod">
<option value="'.$cval.'">'.$cval.'</option>
</select>';
?>

PHP in html

<select name="speriod">
		<option value="<?php echo $cval; ?>"><?php echo $cval; ?></option>
</select>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.