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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.