Can you set the value of a form field in PHP?

I use the $ _GET function to infer a value with php from a URL (http: .... / index.html? Variable = value), the base material. However, I need to use this value in my form.

Normally, I would set

<?php echo 'value="'.$variable.'"' ; ?>

or something like that. However, I cannot use php inside my form using the editor I'm working with.

Is it possible to set a value in a form without using PHP in my form? If so, how?

Edit: using the CMS editor that I use, you cannot store php code on the server. (I use FCKeditor. The same is used by Dubral). This is a security measure in which all CMS even use Wordpress. Basically, I want to send / set the value in the form using php. Similar to how javascript does this: document.form.field.value

+3
source share
3 answers

The best way to set default values ​​(i.e. pre-existing values) in an HTML form, as you mentioned in your question value="'.$variable.'"'.

​​, javascript ( / AJAX -), .

<script type="text/javascript">
document.form[0].name.value = "<?php echo $name; ?>";
</script>
+1

. - Dreamweaver, , , . .

, , , , , , . - .

+2

php, , html. .

-1
source

Source: https://habr.com/ru/post/1747561/


All Articles