0

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 ;

3
  • show us your tried code and submit form.
    – jogesh_pi
    Apr 28, 2014 at 9:48
  • That is just the problem, I don´t know how to start
    – Thom
    Apr 28, 2014 at 9:49
  • why not give the name to the filed? <input type="text" />
    – jogesh_pi
    Apr 28, 2014 at 9:50

3 Answers 3

1
<input type="text" name="unlimited[]" />

if( isset($_POST['submit_button']) ) {
   // Skip blank values
   $unlimited = array_filter( $_POST['unlimited'] );
   $myHighlights = implode(';', $unlimited);
}
1

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.

0
if($_POST)
{    
    $myHighlights = implode(';',$_POST);
    print_r($myHighlights);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.