PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Neeraj Thakur   AJAX Drop-down   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Demonstration file
Class: AJAX Drop-down
Update the options of a select input using AJAX
Author: By
Last change:
Date: 17 years ago
Size: 1,317 bytes
 

Contents

Class file image Download
<html>
<head>
    <script language="JavaScript" src="ajax.js"></script>
    <link href="css.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="loading"></div>

    <table border=0 cellpadding=0 cellspacing="0" align="center" width="40%">
    <form>
        <tr><td colspan="2" height="25"></td></tr>
        <tr><td colspan="2" class="textheading">AJAX Dropdown to Dropdown</td></tr>
        <tr><td colspan="2" height="25"></td></tr>
        <tr><td class="text" width="50%">Select category : </td><td>
                <?php
                   
require_once("getagents.php");
                   
$obj = new AjaxDropdown();
                   
$arr = $obj->getArray(0);
                   
$strRet .= '<option value="0">--Select--</option>';
                    foreach (
$arr as $row )
                    {
                       
$strRet .= '<option value="'.$row->id.'">'.$row->Name.'</option>';
                    }
               
?>
<select name="selCat" class="text" onChange="javascript:Ajax.Request('getagents.php?method=getXML&param=',this.value, Ajax.Response);">
                    <?php echo $strRet; ?>
</select>
                </td></tr>
                <tr><td colspan="2" height="5"></td></tr>
                <tr><td class="text">Sub categories :</td><td>
                <select name="selSubCat" id="selSubCat" class="text">
                    <option value="0">--Select--</option>
                    <option value="12">test</option>
                </select>
                </td></tr>
    </form>
    </table>
</body>
</html>