'How to insert PHP in contact form 7 field body
Do somebody can help me figure out , how to make my PHP code work in contact form 7 body fiel ??
Here is the PHP i want to put in it
<?php echo $some_variable; ?>
Notes: the variable $some_variable; already exist in my backend function.php file here
$s$some_variable; = str_replace("\n", "<br>", get_option('some_variable;'));
} else {
$some_variable = "some text !";
}
Thanks for your help
How my form looks
<script type="text/javascript">
document.getElementById("form-group").reset();
</script>
<label style="font-size:18px; color:#ffffff;"><?php echo $some_variable; ?></label> /// HERE IS WHEN I WANT TO PUT THE PHP CODE
<div id="optionstep2">
<select class="options" name="selling">
<option value="--Selling In--">texxt</option>
<option value="1-3 Months">text 1</option>
<option value="3-6 Months">texte 2</option>
</select>
</div>
</div>
<div>
[submit class:btn class:btn-danger id:sendform2 "send"]
</div>
Solution 1:[1]
For people like me who gonna get this kind of issue, i succeded fixing this just by putting some javascript into the contact form 7 body
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#putphp').val('<?php echo $some_variable; ?>');
});
</script>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dev-doul |
