-2

I am trying to get values from input box and then separated text with , and make it in array and after store it in database.

page save with the name of 'index.php'

There is Form

<form action="index.php" method=post>
   <td>checking array implode</td>
   <td><input name="implo" type="text"  /></td>
</form> 
yasir shah
  • 73
  • 1
  • 9

2 Answers2

1

You can use the PHP explode function in order to separate your input by given delimiter. In your case it would be something like this:

$array = explode(',', $_POST['implo']);

After that you can do a foreach with the array and run INSERT queries in your database.

Here's also a reference for the explode function.

mmvsbg
  • 3,570
  • 17
  • 52
  • 73
1

Try this:

HTML part:

<form action="index.php" method="post">
 <td>checking array implode</td>
  <td><input name="implo[]" type="text"  /></td>
</form>

PHP part:

$implo = explode(',', $_POST['implo']);

$implo variable will be something like this: "first_value,second_value,third_value..."

Deniz B.
  • 2,532
  • 1
  • 18
  • 35