Jump to content

thara

Members
  • Posts

    604
  • Joined

Everything posted by thara

  1. this is my form... <form class="search_code" method="post" action=""> <input type="radio" name="searchCode" class="searchRadio" value="1" <?php if (isset( $searchCode) && $searchCode == 'TutorCode' ) echo "checked"; ?> /> Tutor (LITI) <input type="radio" name="searchCode" class="searchRadio" value="2" <?php if (isset( $searchCode) && $searchCode == 'InstituteCode' ) echo "checked"; ?> /> Center (LICI) <input type="text" name="searchText" class="searchText" value="<?php if (isset( $searchText)) echo $searchText; ?>" /> <input type="submit" value="Go" class="searchGo" /> <input type="hidden" value="TRUE" name="code_search_submitted" /> <p>Enter Member Code <span style="color:red;">(s)</span> separated by comma</p> </form>
  2. I am using a form to take a four digits length number from user..also users can enter more than one number by separating by commas in form's text field. My problem is if it is one number in text field its no problem to me and I can get it to php. but if there are more numbers I cant get those in to php. so anybody can help me to do this? thank you very much.
  3. Its working.. but I want know there is another way to this easily than I did...
  4. I am asking.. have I created above code correctly or is there another easy way to build that? (function and 'if' conditions that I have used) clear???
  5. can I know... there is a best way to do this logic than I have tried so far??? This is my code... //------------ Check code search bar form submission ---------------// if ( isset( $_POST['code_search_submitted'])) { if ( isset( $_POST['searchCode']) && !empty( $_POST['searchText'])) { if (is_numeric( $_POST['searchText']) && (strlen($_POST['searchText']) == 4)) { $searchCode = $_POST['searchCode']; if ( $searchCode == 1 ) { $_SESSION['searchCode'] = 'TutorCode'; } elseif ( $searchCode == 2 ) { $_SESSION['searchCode'] = 'InstituteCode'; } $_SESSION['searchText'] = $_POST['searchText']; } else { $searchingError= 'Ennter four digits for code!'; echo '<script type="text/javascript">'; echo "alert('" . $searchingError . "')"; echo "</script>"; } $url = BASE_URL . 'search/searching.php'; // Define the URL: ob_end_clean(); // Delete the buffer. header("Location: $url"); exit(); // Quit the script. } else { $searchingError= 'Enter Tutor or Institute Code!'; echo '<script type="text/javascript">'; echo "alert('" . $searchingError . "')"; echo "</script>"; } } //---- Check code search bar form submission ----// any comments are greatly appreciated... thank you...
  6. hello... again to this question and I need to modify this with a condition in where clause. I need to search tuition option too along with subject in where clause. so I add it to sub query's where clause like this... WHERE s2.subjects LIKE '%Catholicism%' AND o.option_name = 'Individual' its working.. but problem is same in above subject case. that mean I need to select all tuition option with searching tuition option... in this case it is 'Individual'... again do I need a sub query to do this???? thank you..
  7. as far as I know, .htaccess is the only way to do this...
  8. do you need the same form twice in your page?
  9. thanks PFMaBiSmAd its working now.
  10. I have styled it.. but problem is I cant style when a link is activating... eg: if page 1 is active then I need to add some styles for that link. thats why I need to add another class to the <a>..
  11. no.. I only need to add a class to <a> tag when page is active.. assume page 1 is active.. then I need to add a class to that link.. resion is I need to style the link when it is activating..
  12. this code I used to display paginating links... problem is I need to add some style to the links when its active.. I can style it through some CSS rules.. but at first need to add a class to link tag.. Eg: <a class="selected" ></a> // Make the links to other pages, if necessary. if ($pages > 1) { echo '<div class="pagination">'; echo '<p>'; // Determine what page the script is on: $current_page = ($start/$display) + 1; // If it's not the first page, make a Previous link: if ($current_page != 1) { echo '<a href="searching.php?s=' . ($start - $display) . '&p=' . $pages . '"><</a>'; } // Make all the numbered pages: for ($i = 1; $i <= $pages; $i++) { if ($i != $current_page) { echo '<a href="searching.php?s=' . (($display * ($i - 1))) . '&p=' . $pages . '">' . $i . '</a> '; } else { echo $i . ' '; } } // End of FOR loop. // If it's not the last page, make a Next button: if ($current_page != $pages) { echo '<a href="searching.php?s=' . ($start + $display) . '&p=' . $pages . '">></a>'; } echo '</p>'; // Close the paragraph. echo '</div>'; } // End of links section. can anybody have any idea how to do this? thank you..
  13. sorry.. there is a mistake when naming subject table... now its ok....thanks
  14. thanks for response... I checked it and get this error... what is the problem...sorry I dont have experience in sub query...
  15. yes... just think tutor Bob has 3 subjects "Basket Weaving", "Business Administration" and "Statistics" and a user given a keyword like '%business%' to find a tutor. In my above query then only selecting one subject "business administration'. I need to select all 3 subject with 'business administration'. clear?
  16. no.. I need to get all the subjects with searching subject in where clause.
  17. hello.. again to my select query... this is my updated one. $q = "SELECT tcs.tutor_id AS tid, tcs.category_id AS cid, tcs.subject_id AS sid, GROUP_CONCAT( DISTINCT s.subjects SEPARATOR ', ') AS subjects, t.tutor_name AS tname, t.tutor_code AS tcode, DATE_FORMAT(t.registration_date, '%b %D, %Y') AS date, t.qualification AS qualifi, GROUP_CONCAT( DISTINCT o.option_name SEPARATOR ', ') AS tutor_option, timg.image_name AS img, city_name AS city, d.district_name AS district FROM tutor_category_subject as tcs INNER JOIN subject AS s ON tcs.subject_id = s.subject_id INNER JOIN tutor_option AS toption ON toption.tutor_id = tcs.tutor_id INNER JOIN options AS o ON toption.option_id = o.option_id INNER JOIN tutors AS t ON tcs.tutor_id = t.tutor_id INNER JOIN address ON address.address_id = t.address_id INNER JOIN city ON city.city_id = address.city_id INNER JOIN district AS d ON d.district_id = city.district_id LEFT JOIN tutor_images AS timg ON timg.tutor_id = tcs.tutor_id AND timg.image_type = 'profile' WHERE s.subjects LIKE '%$subject%' GROUP BY tcs.tutor_id"; this query is working now.. now I found a problem. it is..... so many subject may have to one particular tutor. I need to select all the subject that pertaining to a tutor with searching keyword to display with search result. In this query searching keyword is '$subject'. This query only selecting subjects to the tutor similar to the given keyword. For an example if a user give a keyword like 'business' query selecting subjects to that tutor like 'business studies, business accounting., etc only'. so I need to select other subjects too through this query.. can anybody help me? thank you.
  18. but... if there are some profile images to the tutors I want to select those images too...
  19. This is my query.. SELECT tcs.tutor_id AS tid, tcs.category_id AS cid, tcs.subject_id AS sid, GROUP_CONCAT( DISTINCT s.subjects SEPARATOR ', ') AS subjects, t.tutor_name, t.tutor_code AS tcode, DATE_FORMAT(t.registration_date, '%b %D, %Y') AS date, t.qualification, GROUP_CONCAT( DISTINCT o.option_name SEPARATOR ', ') AS tutor_option, timg.image_name AS img FROM tutor_category_subject as tcs INNER JOIN subject AS s ON tcs.subject_id = s.subject_id INNER JOIN tutor_option AS toption ON toption.tutor_id = tcs.tutor_id INNER JOIN options AS o ON toption.option_id = o.option_id INNER JOIN tutors AS t ON tcs.tutor_id = t.tutor_id LEFT JOIN tutor_images AS timg ON timg.tutor_id = tcs.tutor_id WHERE s.subjects LIKE '%business%' AND timg.image_type = 'profile' GROUP BY tcs.tutor_id; This query working properly.. But there is problem with timg's image_type coloum. It is tutor may have their profile image and some tutors dont have profile image. But I need to select all tutors with this condition even if not their profile images. In this query, if there is no profile image to the tutor that tutor not selecting... so how can I do this..? any comments are greatly appreciated. Thank you
  20. I created this select query to get some rows... Its working. but my problem is I need to remove duplicate rows from the query... this is my query: SELECT tcs.tutor_id, tcs.category_id, tcs.subject_id, s.subjects, t.tutor_name, t.tutor_code FROM tutor_category_subject as tcs INNER JOIN subject AS s ON tcs.subject_id = s.subject_id INNER JOIN tutors AS t ON tcs.tutor_id = t.tutor_id WHERE s.subjects LIKE '%business%'; This is its output: Here, you can see tutor id has duplicated in my query. and I need to select all subjects to a tutor in one row separated by comma. eg: (Business & Accounting Studies, Business Studies) like this.. So can anybody tell me what I need to do in my select query?? Thank you.
  21. beeeeney you are correct... so how can i do it???
  22. hi.. can anybody tell me what is the wrong with this code....? <?php // array for tution option for searching $findOptions = array( 1 => 'Private Tutors', 'Tutorial Centers', 'Individual Classes', 'Group Classes', 'Online Classes', 'Study Packs'); // Make the find tution option drop down menu echo '<label><select name="search_option">'; foreach ($findOptions as $key => $value) { echo '<option value="'. $key . '"' ; // Check for stickyness: if ( isset( $_POST['search_option']) && $_POST['search_option'] == $value ) echo ' selected="selected"'; echo " >$value</option>\n"; } echo '</select></label>'; ?> I am trying to make this select box to stickness.. but it is not working.. thanks
  23. after long time, again into this question... I need to make the form stickyness in city select box after the submission... any idea appreciated.. thank you..
×
×
  • 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.