StefanRSA Posted July 2, 2009 Share Posted July 2, 2009 HI, I am using Roshan's Ajax dropdown code for my two ajax dropdown menus. All is working fine, but when I want to use $_POST in the submitted form with FireFox, its not working...??? Its working fine in IE. Can anybody please help me with this problem? The Form where the dropdown is: <!-- Province goes here --> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Province</td><td> <select name="province" onChange="getCity('../dir/townsrc.php?province='+this.value)"> <option value="">Select Province</option> <option value="1">KwaZulu-Natal</option> <option value="2">Western Cape</option> <option value="3">Eastern Cape</option> <option value="4">Free State</option> <option value="5">Gauteng</option> <option value="6">Limpopo</option> <option value="7">Mpumalanga</option> <option value="8">North West</option> <option value="9">Northern Cape</option> </select> </td> </tr> <!-- Province ends here --> <!-- Town goes here --> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Town</td><td> <div id="citydiv"><select name="city"> <option>Select Town</option> </select> </div> </td> </tr> <!-- Town ends here --> The townsrc.php: <? $country=intval($_GET['province']); $query=("SELECT * FROM search_town WHERE provId=$country ORDER BY townLabel ASC"); $result=mysql_query($query); ?> <select name="city"> <option>Select Town</option> <? while($row=mysql_fetch_array($result)) { ?> <option value><?=$row['townLabel']?></option> <? } ?> </select> The submit for: $province = trim($_POST['province']); $city = trim($_POST['city']); In IE $province and $city gets posted In FF only $province gets posted Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/ Share on other sites More sharing options...
mattal999 Posted July 2, 2009 Share Posted July 2, 2009 Show the entire form's code, starting with <form action="... to </form> please. It may help me find the errors, as well as anyone else whom is looking. Oh and by the way, don't use <?, use <?php. The first is a shorttag which can mess up in PHP5. Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/#findComment-867975 Share on other sites More sharing options...
StefanRSA Posted July 2, 2009 Author Share Posted July 2, 2009 Thanks for the help... The entire form: <? //while($edit= mysql_fetch_array($adis)) $catid=$edit[catid]; $adsubcat=$edit[subcatid]; $title=$edit[header]; $radio_options=$edit[r_option]; $rand=$edit[R_rand]; $comment=$edit[text]; $province=$edit[province]; $town=$edit[location]; if ($_GET['delete']=='image') { $deleteimage = $_GET['pic']; //echo $deleteimage; $filename = "../ad_images/$deleteimage"; unlink($filename); mysql_query("DELETE FROM ad_image WHERE ad='$adnr' AND user='$user' AND image='$deleteimage'") or die(mysql_error());echo mysql_error (); //echo "Image deleted!"; } //////////////////////////////////////// IMAGES DELETE END /////////////////////// ?> </div></div> <? ///////////////// HEADER END ///////////// /////////////////// BODY START ///////////// ?> <form action="myadin.php" method="post" enctype="multipart/form-data" onsubmit="return check_form()"> <? $links = mysql_query("SELECT * FROM adcat WHERE disabled<>'1' and id ='$catid'") or died("Database Query Error"); $links2 = mysql_query("SELECT * FROM adsubcat WHERE id ='$adsubcat'") or died("Database Query Error"); $db1 = mysql_fetch_array($links); $db2 = mysql_fetch_array($links2); $pictot = $db2[pictot]; if ($pictot <= 0){ $pictot = 4; } Echo '<div id="myadheader" style="background-color:'.$db1[catcol1].'" text-align:"Left";>'.$brand.' '.$_SESSION['s_username'].' Ad '.$adnumber.' > '.$db1[name].' > '.$db2[name].' >> EDIT</div>'; include 'adstyle.php'; ?> <div id="freemyads"> <table class='myadtable' align='center'> <tr> <th colspan="6">TIP: Complete all fields as accurately as possible to attract more visitors to your ad!</th> </tr> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Ad Title</td><td><input name="title" type="text" class="freeadtextfield" id="title" value="<? echo $title;?>"></td> </tr> <!-- Province goes here --> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Province</td><td> <select name="province" value ="" onChange="getCity('../member/townsrc.php?province='+this.value)"> <option value="">Select Province</option> <option value="1" <?if ($province == '1') {echo 'SELECTED';}?>>KwaZulu-Natal</option> <option value="2" <?if ($province == '2') {echo 'SELECTED';}?>>Western Cape</option> <option value="3" <?if ($province == '3') {echo 'SELECTED';}?>>Eastern Cape</option> <option value="4" <?if ($province == '4') {echo 'SELECTED';}?>>Free State</option> <option value="5" <?if ($province == '5') {echo 'SELECTED';}?>>Gauteng</option> <option value="6" <?if ($province == '6') {echo 'SELECTED';}?>>Limpopo</option> <option value="7" <?if ($province == '7') {echo 'SELECTED';}?>>Mpumalanga</option> <option value="8" <?if ($province == '8') {echo 'SELECTED';}?>>North West</option> <option value="9" <?if ($province == '9') {echo 'SELECTED';}?>>Northern Cape</option> </select> </td> </tr> <!-- Province ends here --> <!-- Town goes here --> <? $townquery=("SELECT * FROM search_town JOIN search_region ON search_region.regionId=search_town.relRegionId JOIN search_prov ON search_prov.provId=search_region.relProvId WHERE search_prov.provId=$province ORDER BY search_town.townLabel ASC"); $townresult=mysql_query($townquery); ?> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Town</td><td> <div id="citydiv"><select name="city" value ="<?echo $town;?>"> <option><?echo $town;?></option> <option>Select Town</option> </select> </div> </td> </tr> <!-- Town ends here --> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Price</td><td> <!-- Price Field Start Here --> <script type="text/javascript"> function check_form() { if (document.getElementById("price").checked) { if (document.getElementById("rand").value.length > 0) { return true } else { alert("You must enter the Price") return false } } return true } </script> <input type="radio" name="radio_options" id="price" value="price" <? if ($radio_options == 'price') { echo 'CHECKED'; } ?> /> Price R <input type="text" name="rand" id="rand" value="<?echo $rand;?>"/><br /> <input type="radio" name="radio_options" id="free" value="option_1" <? if ($radio_options == 'option_1') { echo 'CHECKED'; } ?>/> Free<br /> <input type="radio" name="radio_options" id="contact" value="option_2" <? if ($radio_options == 'option_2') { echo 'CHECKED'; } ?>/> Make Contact<br /> <input type="radio" name="radio_options" id="swap" value="option_3" <? if ($radio_options == 'option_3') { echo 'CHECKED'; } ?>/> Swap / Trade<br /> <!-- Price Field END Here --> </td> </tr> <tr> <!-- Comment Box Start HERE --> <td>-</td><td>-</td><td>-</td><td>-</td><td>Text</td><td><textarea class="freeadboxfield" name="comment" rows="8" cols="41"><? echo $comment; ?></textarea></td> </tr> <!-- Comment Box END HERE --> <tr> </table><br> <? $picuser = $_SESSION['s_username']; //////////////////////////////////// IMAGE UPLOAD SECTION START //include 'image_up.php'; //Echo '<div id="myadheader" style="background-color:'.$db1[catcol1].'" text-align:"Left";>Upload your ad images. (Max 4 images allowed)</div>'; $imaq = mysql_query("SELECT * FROM ad_image WHERE ad ='$adnr' AND user = '$picuser'") or died("Database Query Error"); ?> <table class='myadtable' align='center'> <tr> <th colspan="6">TIP: Ads with images attract more visitors! (Up to <?echo $pictot; ?> images Allowed!)</th> </tr> <tr> <td colspan="6"><center> <? while($image_dir = mysql_fetch_array($imaq)){ $pic = $image_dir['image']; //echo $pic; // //echo $adnr; echo '<a href="../ad_images/'.$pic.'"><img src="pic.php?w=150&img=../ad_images/'.$pic.'" border="1px" /></a><br><a href="../member/myadin.php?edit=ad&ad='.$adnr.'&delete=image&pic='.$pic.'">Remove</a><br>'; } ?></center></td> </tr> <? $number=mysql_num_rows($imaq); $newpic = $pictot - $number; for($i=1;$i<=$newpic;$i++){ echo '<tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Image '.$i.'</td><td><input type="file" name="img'.$i.'"></td> </tr>'; } ////// /////// echo "<input id='adnr' name='adnr' input type='hidden' value='$adnr'>"; echo "<input id='catid' name='catid' input type='hidden' value='$catid'>"; echo "<input id='adsubcat' name='adsubcat' input type='hidden' value='$adsubcat'>"; ?> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td></td><td><input type="submit" name="submitad" class="submitlarge" value="Submit Ad"></td> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/#findComment-867981 Share on other sites More sharing options...
mattal999 Posted July 2, 2009 Share Posted July 2, 2009 I don't think this section is correct: <!-- Town goes here --> <? $townquery=("SELECT * FROM search_town JOIN search_region ON search_region.regionId=search_town.relRegionId JOIN search_prov ON search_prov.provId=search_region.relProvId WHERE search_prov.provId=$province ORDER BY search_town.townLabel ASC"); $townresult=mysql_query($townquery); ?> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Town</td><td> <div id="citydiv"><select name="city" value ="<?echo $town;?>"> <option><?echo $town;?></option> <option>Select Town</option> </select> </div> </td> </tr> <!-- Town ends here --> Try this: <!-- Town goes here --> <? $townquery=("SELECT * FROM search_town JOIN search_region ON search_region.regionId=search_town.relRegionId JOIN search_prov ON search_prov.provId=search_region.relProvId WHERE search_prov.provId=$province ORDER BY search_town.townLabel ASC"); $townresult=mysql_query($townquery); ?> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Town</td><td> <div id="citydiv"><select name="city"> <option>Select Town</option> <option value="<?php echo $town; ?>"><?php echo $town; ?></option> </select> </div> </td> </tr> <!-- Town ends here --> Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/#findComment-867983 Share on other sites More sharing options...
StefanRSA Posted July 2, 2009 Author Share Posted July 2, 2009 Sorry, but I submitted the form I use for editing a submitted form. Here is the form that is submitted and it don't post the City in FF but does in IE. <? ob_start(); session_start(); if($_SESSION['s_logged_n'] == 'true'){ // Include the config files include $root.'../incl/config.php'; // Include the header php include $root.'../header/header.php'; // The body section START $adnumber = $_GET['ad']; //echo $adnumber; $adsubcat = $_GET['subcatid']; $catid = $_GET['catid']; $userid = $_SESSION['s_uid']; # The Menu-Section ##################################################### $sql="SELECT * FROM adcat"; $result=mysql_query($sql); $adis = mysql_query("SELECT * FROM ads WHERE userid ='$userid' AND adnr ='$adnumber'") or died("Database Query Error"); if (!mysql_num_rows($adis)) { ?> </div></div> <? if ($adnumber <= 5 && !$adsubcat && !$catid){ ?> <div id="wrapper" align="center"> <b><p><h3>You Are creating Ad <?echo $adnumber;?></p> <p>Select the category where you want the ad to appear.</h3></p></b><br> <? while($rows = mysql_fetch_array($result)){ $cat_id = $rows['id']; $cat_name = $rows['name']; $tot_ads = $rows['ads']; $cat_desc = $rows['description']; /*MAIN CATEGORIES*/ echo "<div id =".$rows[div].">". $cat_name."<div id=".$rows[divsub].">"; /*SUB CATEGORIES*/ $query = mysql_query("SELECT * FROM adsubcat WHERE catid = '$cat_id'") or die(mysql_error()); while($rows = mysql_fetch_array($query)){ $cat_id = $rows['catid']; $subcat_id = $rows['id']; $sub_desc = $rows['description']; $sub_name = $rows['name']; $tot_subs = $rows['ads']; echo "<div id = wrapper2><li><a href='myad.php?ad=$adnumber&catid=$cat_id&subcatid=$subcat_id'>$sub_name</a></li></div>"; } ?></div></div><? } } Else if ($adnumber >= 1 AND $adnumber <= 5 AND $adsubcat <=74 AND $catid <={ ?> <form action="myadin.php" method="post" enctype="multipart/form-data" onsubmit="return check_form()"> <? $links = mysql_query("SELECT * FROM adcat WHERE disabled<>'1' and id ='$catid'") or died("Database Query Error"); $links2 = mysql_query("SELECT * FROM adsubcat WHERE id ='$adsubcat'") or died("Database Query Error"); $db1 = mysql_fetch_array($links); $db2 = mysql_fetch_array($links2); $pictot = $db2[pictot]; if ($pictot <= 0){ $pictot = 4; } Echo '<div id="myadheader" style="background-color:'.$db1[catcol1].'" text-align:"Left";>'.$brand.' '.$_SESSION['s_username'].' Ad '.$adnumber.' > '.$db1[name].' > '.$db2[name].' >> <a href="../member/myad.php?ad='.$adnumber.'">Change Category</a></div>'; include 'adstyle.php'; ?> <div id="freemyads"> <table class='myadtable' align='center'> <tr> <th colspan="6">TIP: Complete all fields as accurately as possible to attract more visitors to your ad!</th> </tr> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Ad Title</td><td><input name="title" type="text" class="freeadtextfield" id="title" value=""></td> </tr> <!-- Province goes here --> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Province</td><td> <select name="province" onChange="getCity('../member/townsrc.php?province='+this.value)"> <option value="">Select Province</option> <option value="1">KwaZulu-Natal</option> <option value="2">Western Cape</option> <option value="3">Eastern Cape</option> <option value="4">Free State</option> <option value="5">Gauteng</option> <option value="6">Limpopo</option> <option value="7">Mpumalanga</option> <option value="8">North West</option> <option value="9">Northern Cape</option> </select> </td> </tr> <!-- Province ends here --> <!-- Town goes here --> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Town</td><td> <div id="citydiv"><select name="city"> <option>Select Town</option> </select> </div> </td> </tr> <!-- Town ends here --> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Price</td><td> <!-- Price Field Start Here --> <script type="text/javascript"> function check_form() { if (document.getElementById("price").checked) { if (document.getElementById("rand").value.length > 0) { return true } else { alert("You must enter the Price") return false } } return true } </script> <input type="radio" name="radio_options" id="price" value="price" CHECKED/> Price <input type="text" name="rand" id="rand" /><br /> <input type="radio" name="radio_options" id="free" value="option_1" /> Free<br /> <input type="radio" name="radio_options" id="contact" value="option_2" /> Make Contact<br /> <input type="radio" name="radio_options" id="swap" value="option_3" /> Swap / Trade<br /> <!-- Price Field END Here --> </td> </tr> <tr> <!-- Comment Box Start HERE --> <td>-</td><td>-</td><td>-</td><td>-</td><td>Text</td><td><textarea class="freeadboxfield" name="comment" rows="8" cols="41"></textarea></td> </tr> <!-- Comment Box END HERE --> <tr> </table><br> <? //////////////////////////////////// IMAGE UPLOAD SECTION START //include 'image_up.php'; //Echo '<div id="myadheader" style="background-color:'.$db1[catcol1].'" text-align:"Left";>Upload your ad images. (Max 4 images allowed)</div>'; ?> <table class='myadtable' align='center'> <tr> <th colspan="6">TIP: Ads with images attract more visitors! (Up to <?echo $pictot; ?> images Allowed!)</th> </tr> <? /// //echo $pictot; for($i=1;$i<=$pictot;$i++){ echo '<tr> <td>-</td><td>-</td><td>-</td><td>-</td><td>Image '.$i.'</td><td><input type="file" name="img'.$i.'"></td> </tr>'; } ////// /////// echo "<input id='adnr' name='adnr' input type='hidden' value='$adnumber'>"; echo "<input id='catid' name='catid' input type='hidden' value='$catid'>"; echo "<input id='adsubcat' name='adsubcat' input type='hidden' value='$adsubcat'>"; echo "<input id='pictot' name='pictot' input type='hidden' value='$pictot'>"; ?> <tr> <td>-</td><td>-</td><td>-</td><td>-</td><td></td><td><input type="submit" name="submitad" class="submitlarge" value="Submit Ad"></td> </tr> </table> <table class='myadtable' align='center'> <tr> <td>SORRY - ONLY 5 AD-SLOTS AVAILABLE with the Howzit-FREE account (TIP: Delete your old, out-of-date ads now).</td> </tr> </table> <br> </div> <div id="memfreeadvert"> <p>STILL REQUIRE MORE AD-SLOTS?</p> <p>Why not upgrade to one of our super-packages? (COMING SOON!!!)</p> <p>Howzit-LITE: R50 per year (20 Ad-slots)<br> Best suite anyone who just needs extra Ad-slots</p> <p>Howzit-LITE+plus: R50 per year (20 Ad-slots)<br> Best suite anyone who just needs extra Ad-slots</p> <p>Howzit-LITE: R50 per year (20 Ad-slots)<br> Best suite anyone who just needs extra Ad-slots</p> <p>Howzit-LITE: R50 per year (20 Ad-slots)<br> Best suite anyone who just needs extra Ad-slots</p> </div> <? //////////////////////////////////////////////////////////////////////////////// // The body section END include '../footer/footer.php'; } Else { header("Location: ../member/member.php"); } ?> </div> </center> <? } else { // Here we will edit the ad if exists header("Location: ../member/member.php"); } } else { /*echo $_SESSION['s_logged_n'].'b'; echo $_SESSION['s_username'].'c'; echo $_SESSION['s_name'].'d';*/ header("Location: ../member/login.php"); } ob_end_flush();?> Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/#findComment-867988 Share on other sites More sharing options...
mattal999 Posted July 2, 2009 Share Posted July 2, 2009 This: <option>Select Town</option> And any options for that matter, need to have a value set: <option value="Select Town">Select Town</option> <option value="Whatever">Whatever</option> Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/#findComment-868048 Share on other sites More sharing options...
StefanRSA Posted July 2, 2009 Author Share Posted July 2, 2009 It does! It gets populated by townsrc.php and AJAX... Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/#findComment-868052 Share on other sites More sharing options...
mattal999 Posted July 2, 2009 Share Posted July 2, 2009 I can't help you then, it would be more appropriate to make another thread in the AJAX section or ask a moderator to move it there. I'm pretty sure the AJAX isn't doing its job properly then if it works in IE but not FF. Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/#findComment-868063 Share on other sites More sharing options...
StefanRSA Posted July 2, 2009 Author Share Posted July 2, 2009 You might be right... Will write a new ad that side! Link to comment https://forums.phpfreaks.com/topic/164553-problem-with-php-mysql-ajax-dropdown-script/#findComment-868067 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.