I have a form in which there are many span elements and every span element have their id's my span tag is working as a input text field for form now I want to send the span field value to my php file to insert in my db like in php $_POST['fname']
this value we can get if we are using input type text but if it is a span how to do this?
My code is:
<form action="form_submit1" method="POST">
<div class="form-group">
<span class= "sexyform" id="6" name="fname" data-placeholder="Enter Your First Name"></span>
</div>
</form>
You use ajax
$(document).on("click", ".sexyform", function () {
var id=$(this).attr('id');
$.ajax({
type: 'POST',
url: "form_submit1",
data:{fname:id},
success: function (result) {
your action after success
},
})
})