Location: PHPKode > projects > PHP Cad and Drawing Program > second.php
<?php

$c = opendir("./functions");
$inclist = array();
while($file = readdir($c)) if (ereg("inc",$file)) array_push($inclist,$file);
sort($inclist);
closedir ($c);


$flag=0;
    foreach ($inclist as $incname) {
        $zzz = file("./functions/$incname");
	foreach ($zzz as $lineitem) {
            if (substr_count($lineitem,"D")>15) $ptr="a";
            if (substr_count($lineitem,"E")>15) $ptr="b";
            if ($ptr=="D") $aaaaa=$aaaaa . $lineitem;
            if ($ptr=="a") $ptr="D";
        }
        eval("$aaaaa");
        if ($inthemenu=="yes") {
            if ($flag==0) {
                foreach ($dirlist as $diritem) {
                    $sdir = $sdir . "<option>$diritem</option>\n";
                }
                foreach ($lenlist as $lenitem) {
                    $slen = $slen . "<option>$lenitem</option>\n";
                }
                $stxt = $txtitem;
            }
        $incname=str_replace(".inc","",$incname);
	$sobj=$sobj . "<option>$incname</option>\n";
        $aflag=0;
        $bflag=0;
        foreach ($dirlist as $diritem) {
             $gdir = $gdir . "group[$flag][$aflag] = new Option('$diritem')\n";
             $aflag=$aflag+1;
        }
        $gdir = $gdir . "group[$flag][$aflag] = new Option('Help')\n";
	foreach ($lenlist as $lenitem) {
             $glen = $glen . "grouplen[$flag][$bflag] = new Option('$lenitem')\n";
             $bflag=$bflag+1;
        }
    $gtxt = $gtxt . "grouptxt[$flag] = '$txtitem'\n";


    $flag = $flag + 1;
    }

}
    $gdir = $gdir . "group[$flag][0] = new Option('NA')\n";
    $glen = $glen . "grouplen[$flag][0] = new Option('NA')\n";
    $gtxt = $gtxt . "grouptxt[$flag] = ''\n";
    $flag = $flag + 1;
    $gdir = $gdir . "group[$flag][0] = new Option('NA')\n";
    $glen = $glen . "grouplen[$flag][0] = new Option('NA')\n";
    $gtxt = $gtxt . "grouptxt[$flag] = ''\n";
    $sobj=$sobj . "<option>Delete</option>\n";
    $sobj=$sobj . "<option>DeleteRectangle</option>\n";



$a="
<form name='second' action='scriptmaker.php'>
    <select name='PObj' onChange='redirect(this.options.selectedIndex)'>
$sobj
    </select>
    <select name='PDir'>
$sdir
    </select>
    <select name='PLen'>
$slen
    </select>
    <input type=text name='PTxt' value='$stxt' size='30' align='top' align='right'>
    <input type=hidden name=u value='$u'>
    <input type=hidden name=v value='$v'>
    <input type=hidden name=pfilez value='$pfilez'>
    <input value='Submit' type='submit'>
</form>

<script>
/*
Second Form Script Credit
Originally by JavaScript Kit (www.javascriptkit.com)
*/

var groups=document.second.PObj.options.length
var group=new Array(groups)

for (i = 0; i < groups; i++)
    group[i]=new Array()
$gdir
var tempdir=document.second.PDir


var grouplen=new Array(groups)
for (i = 0; i < groups; i++)
    grouplen[i]=new Array()
$glen
var templen=document.second.PLen


var grouptxt=new Array(groups)
for (i = 0; i < groups; i++)
    grouptxt[i]=new Array()
$gtxt
var temptxt=document.second.PTxt

function redirect(x) {
    for (m = tempdir.options.length-1; m > 0; m--)
        tempdir.options[m]=null
    for (i = 0; i < group[x].length; i++) {
        tempdir.options[i]=new Option(group[x][i].value)
    }
    tempdir.options[0].selected=true

    for (m = templen.options.length-1; m > 0; m--)
        templen.options[m]=null
    for (i = 0; i < grouplen[x].length; i++) {
        templen.options[i]=new Option(grouplen[x][i].value)
    }
    templen.options[0].selected=true

    temptxt.value=null
    temptxt.value=grouptxt[x]
}
</script>
";
echo $a
?>
Return current item: PHP Cad and Drawing Program