"will be 3 inputs with the same ID"
I don’t know how your code is, but just to show you that you can recover everything from the other side of php - even with elements of the same id.
I suggest you generate the id dynamically (I don’t know if that’s your question) but here’s a code that shows you can pass the information and recover with POST in php.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="test.php" method="post">
<input id="as" type="text" name="valor[]" value="1"><br>
<input id="as" type="text" name="valor[]" value="2"><br>
<input id="as" type="text" name="valor[]" value="3"><br>
<input id="as" type="submit" value="Submit">
</form>
<?php
$arr=$_POST["valor"];
echo '<pre>';
print_r($arr);
echo '</pre>';
?>
</body>
</html>
Note what happens in the POST array:
Test this code to retrieve values using classes and not Ids
//HTML
<form action="test.php" method="post">
<input id="as" class="tosend" type="text" name="valor[]" value="1"><br>
<input id="as" class="tosend" type="text" name="valor[]" value="2"><br>
<input id="as" class="tosend" type="text" name="valor[]" value="3"><br>
<input id="btntosend" class="btntosend" type="submit" value="Submit">
</form>
//Js
$('#btntosend').on( 'click', function(e) {
e.preventDefault();
$('.tosend').each(function() {//Passar por cada radio da classe rdShipMo
alert($(this).val());
});
});
See the fiddle. You don’t even need Id.
Put the code as far as you can so we can help you.
– Ivan Ferrer
Elements on the same page that share the same ID is invalid, incorrect and will never work. The solution to your problem is to stop working with
id
and start working withclass
.– Zuul