Im somewhat stuck here
So the above code simply fills my dropdown box with company names from a database.Code:<select name="companyfilter"> <option value="">Filter by company</option> <?php /* SHOW COMPANY NAMES */ $query="SELECT callid, company FROM ring WHERE userid=? ORDER BY callid ASC LIMIT ".($nCurrentPage-1)*$nItemsPerPage.", $nItemsPerPage"; $stmt = $mysqli->prepare($query); $stmt->bind_param('i', $uid); $stmt->execute(); $stmt->bind_result($callid1, $company1); $stmt->store_result(); if ($stmt->num_rows>0) { while ($stmt->fetch()) { ?> <option value="<?php echo $company1;?>"><?php echo $company1;?></option> <?php } } ?> </select> <input name="show" value="Show" type="submit"><br /> </form>
The above just gets whatever has been chosen and uses it to filter results further in my page.Code:/* IF COMPANY FILTER USED THEN FILTER */ if (isset ($_POST['show'])) { $company2filter = $_POST['companyfilter']; }
What I'd like to do is get rid of the submit button, and instead just by using onChange post the correct variable as required.
Can you help with this? I'm confused how to go about it.




Reply With Quote