Download Coding
array.php:
Implode.php:
array.php:
<form name="aform" method="post"> <table border="0px" cellpadding="10" cellspacing="0" id="tbl"> <tr><td align="center" colspan="2">Driving Form</td></tr> <tr> <td>vehicle</td> <td> <select name="mul[]" multiple style="width:150px;" size="10"> <option value="Rohini">Rohini</option> <option value="Rogini">Rogini</option> <option value="Rokini">Rokini</option> <option value="rubini">rubini</option> <option value="Rohini">Rohini
</option> <option value="Rogini">Rogini</option> <option value="Rokini">Rokini</option> <option value="rubini">rubini</option> <option value="Rohini">Rohini</option> <option value="Rogini">Rogini</option> <option value="Rokini">Rokini</option> <option value="rubini">rubini</option> <option value="Rohini">Rohini</option> <option value="Rogini">Rogini</option> <option value="Rokini">Rokini</option> <option value="rubini">rubini</option> </select> </td></tr> <tr>
<td colspan="2" align="center"><input type="submit" name="submit"
value="submit" /></td></tr>
</table> </form>
Implode.php:
<?php $conn=mysql_connect("localhost","root",""); $select_db=mysql_select_db("each_db",$conn); if(isset($_POST['submit'])) { $val=implode(',',$_POST['mul']); $insert=mysql_query("insert into a(val) values('$val')"); } ?>
Explode.php:
<?php
$conn=mysql_connect("localhost","root",""); $select_db=mysql_select_db("each_db",$conn); if(isset($_POST['submit'])) { $val=implode(',',$_POST['mul']); $insert=mysql_query("insert into a(val) values('$val')"); $select_tbl=mysql_query("select * from a",$conn); while($fetch=mysql_fetch_object($select_tbl)) { $r=$fetch->val; $i=explode(",",$r); }}
Script:
<script type="text/javascript"> function validation() { var name=document.aform.vehicle.value; if(name=="" || name=="null") { alert("mark ur value"); document.aform.vehicle.focus(); return false; } } </script>
No comments:
Post a Comment