1

How get value to one field from multiple textbox?

i have example 3 textbox

<input name="post_code[]" class="input form-control" id="tbCode1" placeholder="Code 1" type="text" value="A01">
<input name="post_code[]" class="input form-control" id="tbCode2" placeholder="Code 2" type="text" value="A02">
<input name="post_code[]" class="input form-control" id="tbCode3" placeholder="Code 3" type="text" value="A03">

but how make the value like this

$postcode = 'A01,A02,A03';

before insert to mysql

1
  • 1
    see this link to understand in detail: sanwebe.com/2013/04/… Commented Dec 10, 2015 at 6:25

2 Answers 2

1

Use implode()

$post_code = $_POST['post_code'];
$postcode = implode(",",$post_code);
Sign up to request clarification or add additional context in comments.

Comments

0
$a = implode(",", $_POST['post_code']);
echo $a;

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.