mysql - php from text field to array -


how can add multiple text fields in 1 array? code

html

<form method="post"> <input type="text" class="span6" name="hashtags" /> <input type="text" class="span6" name="hashtags" /> <input type="text" class="span6" name="hashtags" /> <input type="text" class="span6" name="hashtags" /> </form> 

php

$arr = array($_post['hashtags']); $arraz = serialize($arr); $a = addslashes($arraz); 

sql

insert table(hashtags) values ($a) 

and inserts value last text field, how can insert text field values?

if you're going have inputs share similar name , want retrieve them array, have have following construction. notice [] @ end of name.

<input type="text" class="span6" name="hashtags[]" /> 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -