Help : Change Textbox from Dropdown List through AJax and PHP

Discussion in 'PHP' started by muhoilya, Oct 21, 2009.

  1. #1
    I need to get price from multidimentional array through ajax.
    I have some thing like this. I have to select Day and type of paper through Dropdowns & then Display price where it intersect.

    Day1 Day2
    school 14.75$ , 13.75$
    undergraduate 16.75$ , 15.75$
    Master 18.75$ , 17.75$
    PHD 21.75$ , 17.75$


    <?php
    $row = $_POST['day'];
    $col = $_POST['type'];
    $shop = array( array("school", 14.75 , 13.75),
                   array("undergraduate", 16.75 , 15.75),
                   array("Master", 18.75 , 17.75),
    	       array("PHD", 21.75 , 17.75) 
                 ); 
    ?>
    
    
    
    PHP:
    <form method="POST" name="selectionForm">
     <?php 
       echo "<b>Urgency</b><br>
        <select name='day' id='day' > 
    	
    	<option  name='Steak' value='0'>  
        Please Select</option>
        <option  name='Meat' value='1' >1 Day</option>
    	<option  name='Chicken' value='2' >2 day</option>
        <option name='Sushi' value='3' >3 Day</option>
        </select>
        <br><br>
    
      
      <b>Writer Levels</b><br>
        <select name='type' id='type'> 
    	
    	<option  name='one' value='0'>Please Select</option>
        <option  name='two' value='1' >  
        High School $10.00</option>
    	<option  name='three' value='2' >  
        College $12.00</option>
        <option name='four' value='3' >University $15.00 </option>
        </select>
        <br><br>";
    	
    	echo "<strong>Your total is:</strong>
        <input type='text' name='total' >.$shop[$row][$col].</input>";
      	
      ?>
        
    PHP:
     
    muhoilya, Oct 21, 2009 IP