Reputation: 621
I have a div in my page called .highlights
.
In this div I have a unknown numbers of text input(<input type="text" />
). It can range from 0 to unknown.
When someone clicks at submit, I want to store in PHP all the values of the inputs, into one variable called myHighlights
. The values must be seperated by ;
Upvotes: 0
Views: 93
Reputation: 2437
if($_POST)
{
$myHighlights = implode(';',$_POST);
print_r($myHighlights);
}
Upvotes: 0
Reputation: 9782
<input type="text" name="unlimited[]" />
if( isset($_POST['submit_button']) ) {
// Skip blank values
$unlimited = array_filter( $_POST['unlimited'] );
$myHighlights = implode(';', $unlimited);
}
Upvotes: 1
Reputation: 146460
To begin with, you'll have to assign names to the controls so they get sent together with the rest of of the form. Please have a look at the How do I create arrays in a HTML <form>
? entry of the PHP FAQ for a nifty trick.
Upvotes: 1