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
Post a Comment