Before I explain my problem here are the files I have created -

create.php
PHP Code:
<form action="#" method="post">
Name:<input type="text" name="tab"/>Number of Fields:<input tabindex="text" name="colnum"/>
<input type="submit" />
</form>
<?php

if(isset($_POST['tab']) and isset($_POST['colnum'])){
    if(
$_POST['colnum']>0)
    {
        echo 
'<form action="createn.php" method="post">';
        foreach(
range(1,$_POST['colnum']) as $index)
        {
            echo 
$index;
            echo 
') ColName<input type="text" name="colname'.$index.'"> ';
            echo 
'Type<input type="text" name="type'.$index.'">';
            echo 
'<input type="hidden" name="tab" value="'.$_POST['tab'].'"/>';
            echo 
'<input type="hidden" name="colnum" value="'.$_POST['colnum'].'"/>';
            echo 
'<br/>';
            
        }
        echo 
'<input type="submit"/>';
        echo 
'</form>';
    }
    else
    echo 
"Number of fields should be greater then 0";
}
else
{
    echo 
"Fill in both the fields";
}
?>
createn.php
PHP Code:
<?php
$conn
=oci_connect('scott','tiger');
$tabname=$_POST['tab'];
foreach(
range(1,$_POST['colnum']) as $index)
{
    echo 
$_POST["colname".$index];
    echo 
$_POST["type".$index];
        echo 
'<br/>';
}

echo 
"Table name =".$tabname;

$query='create table '.$tabname.'('.$_POST["colname1"].' '.$_POST["type1"].')';
$statement=oci_parse($conn,$query);
if(
oci_execute($statement))
{
    echo 
"Table created";
}
else
{
    echo 
'no table created';
}
?>
Create.php explanation ->
On running it gives a form asking for table name and number of fields:
Suppose I enter table name as "EMP" and no. of fields as "2".. and press submit.. now on the same page I'll get two sets of field each containing 2 boxes (ie Name and Type)..
When I fill in both the field set with let's say -
1) Name: -"empno" Type: -"number"
2) Name: -"ename" Type: -"varchar2"
and press submit it the form submits the values to "createn.php"

Createn.php explanation ->
On this file I want to form a statement to create a new table with all the inputed data... ie something as follows -
"create table <table_name>(<column 1> <type1>,<column 2> <type2>,....)"

The code I have written in this file puts only 1 column and it's type as I have manually entered it. But suppose I don't know how many column is user going to put in.. then in that case how can I code the above stated statement in bold?