Crewow is a Blog contains Free Web Training's, Tutorials, Resources and much more. It will feature best Tutorials related Jquery, PHP, Ajax, CSS and other Web development languages. It will also tell you the sites from where you can get best web resources. Creatively Wow!
PHP Dynamic Select options Via Ajax is tutorial for those who want to make 2 dynamic select options in form. one is dependent on other and data fetched from MySQL Database. Website for Complete Tutorial is Crewow
Open your Dreamweaver or Notepad editor and create new PHP Page and name it myform.php
Now Create only one Table for Categories like this
CREATE TABLE IF NOT EXISTS `category` (
`SrNo` int(11) NOT NULL AUTO_INCREMENT,
`Category` varchar(50) NOT NULL,
`SubCategory` varchar(100) NOT NULL,
PRIMARY KEY (`SrNo`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Now we need to make another PHP Page in which we will run query for sub category fields. Name it Ajax_SubCategory.php
Config.php file for connecting to PHP.
id will be posted via Ajax script. please see point no.7
$sql=mysql_query("select SubCategory from category where Category='$id'");
echo '<option value="'.$data.'">'.$data.'</option>';
Now we will call Ajax_SubCategory.php via Ajax and Jquery in myform.php. please includeJquery in your myform.php
Below line will get value of Category and store in id
var dataString = 'id='+ id;
This will get values from Ajax_SubCategory.php and show in Subcategory Select option
Above tutorial can be used for making dynamic select option or options. You can also use some features of this tutorials. For more information please visit Crewow | Free Website Tutorials
Now write below lines . you just need to provide your table name where you want to import data. leave all other lines as it is.
create new importer object for importing data
$c = new CSV_Importer;
display log errors at end
$c->log_errors = true;
skip the very first row in CSV file
$c->skip_top = true;
Type of Server (default MYSQL), you can also use this MSSQL and PGSQL
$c->server = MYSQL;
Database Table where File will be imported
$c->table = "yourtablename";
Now you have to set columns of table according to your CSV file Template
Here you will write csv file reference from which your data will be imported to Table
$result = $c->import("Your_CSV_Name.csv",$conn);
Now include csv_importer.php file in your page like below.
if($result === FALSE)
there was some error importing data
Your data imported successfully, it will print number of rows inserted.
print "Total records inserted are $result in table $c->table";
in the end you will close MySQL Connection
Above tutorial is based on scriptbaba 2009 scripts. Now that website is not working so I write this tutorial for you. For more information please open Crewow Website