Sujan Shrestha Sujan Shrestha - 7 months ago 17
SQL Question

How to join multiple column values into one column while inserting

I have a table which looks like this:

ID | Name | Address

I have a form which looks like this:

<input type="text" class="form-control" name="name"/>
<input type="text" class="form-control" name="address"/>

My PHP Code:

$name = $_POST['name'];
$address = $_POST['address'];
$sql = "Insert into staff(client_name,address) VALUES ('$client_name','$address')";

What i want to do is, join the values posted by user into one column.i.e if user types JOHN in Name field and USA in address field.
I want to following in my database table

ID | Name | Address


use thomething like this:

$sql = "Insert into staff(client_name,address) VALUES ('$client_name $address','$address')";