+ 2
Set a $_POST value
Hello, I have an html form which has one input with the name "msg". However I need to add another attribute which is set by javascript so I can access it through $_POST[] as well. How can I do this?
4 Réponses
+ 16
Attributes are not accessible via $_POST object. The name attribute is only used to define the key for the input value.
+ 11
The only way would be ajax requests.
+ 3
Still how can I access any javascript variable with php? In anyway there is, I just want to pass information.
+ 3
you can use
<form action=response.php>
<input type=text name=message>
and after submitting the form via get or post u can use $_GET['message'] or $_POST['message']
to get the input from user ...
you cant really use JavaScript variable to php ..