Jump to content

ajax help needed


airdee

Recommended Posts

my form works when i select something on the province pull down menu, it will generate another listing of area pull down menu.

 

my problem is when the form is save (process.php), it saves nothing on select name='city'. and why is it that when i view the source code of addlisting.php, nothing is printed on the ajax part (getarea.php) even though it is visible on the web page?

 

please help.

------->process.php

------->selectarea.js

 

------->getarea.php

<?php

$q=$_GET["q"];

$con = mysql_connect('localhost', 'username', 'pass');

if (!$con) {

die('Could not connect: ' . mysql_error());

}

mysql_select_db("thedb", $con);

$sql="SELECT * FROM province_to_area WHERE id = '".$q."'";

$result = mysql_query($sql);

echo "<select class='select' name='city'>";

while($row = mysql_fetch_object($result)){

                      $id=$row->id;

                      $name=$row->area;

                        echo "<option value='$id'";

                        echo ">$name</option>";   

}

echo "</select>";

?>

 

------->addlisting.php this part is within a form with submit button to action=process.php

                    <tr>

                      <td class="inputlbl">Province/State:</td>

                      <td width="65%">

                      <select class="select" name="province" onchange="showUser(this.value)">

                      <?

                      $result=mysql_query("select * from province");

                      while($row=mysql_fetch_object($result)){

                      $id=$row->id;

                      $name=$row->name;

                        echo "<option value='$id'";

                        echo ">$name</option>\n";   

                      }

                      ?>

                      </select>                                         

                      </td>

                    </tr>

                    <tr>

                      <td class="inputlbl">Area:</td>

                      <td id="txtHint" width="65%">Please select province

                      </td>

                    </tr>

 

Please let me know if you need some other info. thank you very much.

Link to comment
https://forums.phpfreaks.com/topic/49671-ajax-help-needed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.