Im trying to show GET
variable data in a textarea
. I tried may solutions in StackOverflow but none of them worked. I have no idea why. Can you please tell me if I'm missing something.
My Story
I have a link on a page and href
is /index.php?page=contact-us&performance=Lamborghini
and it takes me to the Contact Us page and the url is still /index.php?page=contact-us&performance=Lamborghini
which is what I want.
So, Im tyring to grab performance
variables's content which is Lamborghini and print it in a textarea
which is
<textarea name="m62b34fbrp__32" cols="19" rows="7" class="cms_textarea" id="fbrp__32"></textarea>
So what I did is added <?php $performanceInfo= $_GET['performance']; ?>
to the top of my page. Then added $("#fbrp__32").val(<?php echo $performanceInfo; ?>);
in my script.js
file. But it never prints Lamborghini in the textarea
.
When I try $("#fbrp__32").val('<?php echo $performanceInfo; ?>');
(Notice the '
marks) it prints <?php echo $performanceInfo; ?>
in the textarea
.
When I <?php echo $_GET["performance"]; ?>
it prints Lamborghini fine too.
Can you guys tell me why its not working for me?
NOTE : I cant edit the textarea
manually as it is generated using a plugin
Thanks a lot.