php - Upload multiple image into different column of database when if has same name -


i working core php. want upload multiple image 5 , insert databse. have created 5 different field have same name. code :

<input type="file" class="form-control" name="slider_image[]" id="inputpassword1" placeholder="offer days" required> <input type="file" class="form-control" name="slider_image[]" id="inputpassword1" placeholder="offer days" required> <input type="file" class="form-control" name="slider_image[]" id="inputpassword1" placeholder="offer days" required> <input type="file" class="form-control" name="slider_image[]" id="inputpassword1" placeholder="offer days" required> <input type="file" class="form-control" name="slider_image[]" id="inputpassword1" placeholder="offer days" required> <input type="submit" name ="submit"> 

and php code like:

if(isset($_post['submit'])) {   $image = $_files['slider_image']['name'];   $temp = $_files['slider_image']['temp'];  $path = "upload/";  foreach ($image $key => $value) {     //echo $value."---"; } 

output of pirnt_r($image) :

array( [0] =&gt; 001.jpg [1] =&gt; 001.jpg [2] =&gt; 001.jpg [3] =&gt; 001.jpg [4] =&gt; 001.jpg ) 

and table name slider , field's :

1)id 2)slider1 3)slider2 4)slider3 5)slider4 6)slider5 how can insert slider image different fields when has same post name?

you can assign array values local variables , local variables can use in sql query.

$var1 = array[0] $var2 = array[1] $var3 = array[2] $var4 = array[3] $var5 = array[4] 

use these variables in query.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -