shubham jha shubham jha - 10 months ago 38
SQL Question

Concat data and store in database

I am working on a project where I have 3 input fields with different names values. For example:

<input type="text" name="name1">
<input type="text" name="name2">
<input type="text" name="name3">`

and I have stored the POST values in
$name1, $name2 and $name3
(for example).

But I have only 1 field in database say
. What I want to do is to store all the 3 names in the same field as a comma separated value. I am new to PHP here and I have heard that it can be done by concatenation and implode function or something. However I am unaware of the process.

$new_value_to_be_stored = $name1 .",". $name2 .",". $name3;

use concatenation like so.Hope it helps !