[Solved] How do I use a div as an input? [closed]


There are several ways to achieve this.

But all of them requires knowledge in javascript (JQuery for more advanced features).

You could try create a form with an hidden input and by clicking the div it will put the value in there and submit a form.

For example:

HTML:

<div id = "settingValue" data-value = "some value">Click Me</div>
<form id = "myForm" action = "myPhpFile.php" method = "post">
  <input type = "hidden" name = "myName" id = "gettingValue">
</form>

Javascript:

$('#settingValue').click(function(){
  var value = $(this).data('value');
  $('#gettingValue').val(value);
  $('#myForm').submit();
});

And in your myPhpFile.php

<?php
$value = $_POST['myName'];
?>

solved How do I use a div as an input? [closed]