This question already has an answer here:
i wanted to fill a form field in my webpage using URL parameters, i have a form in the page with several fields, currently, i am just testing with one fiel named "name-1-field", i a newbie in web and have poor knowledge of PHP and java script, some one gave me this code snippet to use in page's footer in order to fill the field : the problem i enter is like this:
"http://***.com/testform/?name1=John"
<script type='text/javascript'>
var fieldValue = '<?php echo $_GET["name1"]; ?>';
jQuery( "#name-1-field" ).val( fieldValue );
</script>
but the value that the field is filled with is this (i mean the whole string below)
<?php echo $_GET["name1"]; ?>
not the string "John"
Aucun commentaire:
Enregistrer un commentaire