php - Get value from array of textbox with array of buttons -


it's 2nd time post here. again i'm not proficient in logic nor php, please bear messy codes :)

i have array of textboxes value , there array of buttons next it. i've managed display value of text box corresponding button dialog box (thanks mr.barmer here)

then intend save specific value textbox have captured database, here have no clue should do. try "echo" value of textbox insert into

($link=((document.getelementbyid('link$i').value))) 

but got no result.

my question is: should add codes retrieve value textbox, when clicked corresponding button , save database, or capture value , store in

(ex:$link=$_post['link']) 

then post using echo $link?

here's piece of php codes i'm talking about:

$data = mysql_query("select * tempimg");  while($hasil = mysql_fetch_array($data)){          $i++;     echo "<tr>         <td align='center'><input type= checkbox name=check[]                  value=$hasil[idfoto]</td>         <td align='center'><img src=$hasil[thumbpath]></td>         <td align='center'>$hasil[imgname]</td>         <td align='center'>$hasil[thumbpath]</td>         <td align='center'>$hasil[path]</td>         <td align='center'>          <label class=text_label> $hasil[imglink]</label>         <div class=edit></div>         <input type=text align=center value=$hasil[imglink]                  name=link[{$hasil['idfoto']}] id=link$i />         <div class=clear></div>           <td align=center>          <button type=submit =             onclick=\"return confirm('you clicked button $i                  id: $hasil[idfoto] '+'value: '                 +(document.getelementbyid('link$i').value))\">         <img src=images/sav.png alt=search-btn id=img />         </button>          </td>         <td align=center><img src=images/del.png></img></td>";     } 

and here's ss of page i'm working http://imgur.com/ftkas8k

just need "70" , "test.com" value , "echo" it, rest of database query i'll try work out myself. humbly request people here, please me. thank attention

first of all, you'll need change php code (above) this:

<script> $(function() {     $(document).on('click','.savebutton',function() {         var imagenumber = $(this).closest('tr').data('imgnum');         var imagelink = $(this).closest('tr').data('imglink');         $.get('process_img.php',{n:imgnumber,l:imglink});     }); }); </script>     <?php $data = mysql_query("select * tempimg");  while($hasil = mysql_fetch_array($data)){          $i++; ?> <tr data-imgnum="<?=$i;?>" data-imglink="<?=$hasil['imglink'];?>">     <td align='center'><input type="checkbox" name="check[]" value="<?=$hasil['idfoto'];?>" /></td>     <td align='center'><img src="<?=$hasil['thumbpath'];?>" /></td>     <td align='center'><?=$hasil['imgname'];?></td>     <td align='center'><?=$hasil['thumbpath'];?></td>     <td align='center'><?=$hasil['path'];?></td>     <td align='center'>         <label class="text_label"><?=$hasil['imglink'];?></label>         <div class="edit"></div>         <input type="text" align="center" value="<?=$hasil['imglink'];?>" name="link[{<?=$hasil['idfoto'];?>}" id="link<?=$i;?>" />         <div class="clear"></div>      </td>     <td align="center">         <input type="button" class="savebutton">             <img src="images/sav.png" alt="search-btn" id="img" />         </input>     </td>     <td align="center"><img src="images/del.png" /></td> <?php } ?> 

then you'll need write new php script named process_img.php:

<?php $n = $_request['n']; // number (70) $i = $_request['i']; // link (test.com) //  save info database ?> 

this gives terrific head start. tutorials online.......


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -