PHP - Hide Specific Shipping Methods For Specific Roles
I use the Wholesale Suite Premium Prices plugin with WooCommerce. I have 6 specific wholesale roles out of 15 that I wish to hide two specific shipping methods from being selected for the 6 exceptions. I'm just trying this on my staging server at this time using a code snippet example that I found and modified for my specific conditions. Would the following work for this purpose? /* Hide specific shipping methods for specific wholesale roles */ add_filter( 'woocommerce_package_rates', function( $shipping_rates ) { // User role and shipping method ID to hide for the user role $role_shipping_method_arr = array( 'ws_silvia_silver' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_silver_pst_exempt' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_silver_tax_exempt' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_silver' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_silver_pst_exempt' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_silver_tax_exempt' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_gold' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_gold_pst_exempt' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_gold_tax_exempt' => array( 'Silvia Premium Standard Shipping (Tracking Service)'), 'ws_silvia_gold' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_gold_pst_exempt' => array( 'Silvia Union Standard Shipping (Tracking Service)'), 'ws_silvia_gold_tax_exempt' => array( 'Silvia Union Standard Shipping (Tracking Service)'), ); // Getting the current user role $curr_user = wp_get_current_user(); $curr_user_data = get_userdata($current_user->ID); // Wholesale Suite Roles if (isset($current_user) && class_exists('WWP_Wholesale_Roles')) { $wwp_wholesale_roles = WWP_Wholesale_Roles::getInstance(); $wwp_wholesale_role = $wwp_wholesale_roles->getUserWholesaleRole(); // Loop through the user role and shipping method pair foreach( $role_shipping_method_arr as $role => $shipping_methods_to_hide ) { // Check if defined role exist in current user role or not if( in_array( $role, $current_user->roles) ) { // Loop through all the shipping rates foreach( $shipping_rates as $shipping_method_key => $shipping_method ) { $shipping_id = $shipping_method->get_id(); // Unset the shipping method if found if( in_array( $shipping_id, $shipping_methods_to_hide) ) { unset($shipping_rates[$shipping_method_key]); } } } } } return $shipping_rates; }); Any insights as to how to accomplish this would be greatly appreciated. Lyse Similar TutorialsHello all! Well, here's my dilemma. I understand how PHP and server side code works, I understand the important basics about PHP in general, I just need more specific help. I'm currently working with a partner in building a website that allows users to basically enter in information in text fields, add a picture to their post, and choose from a drop down menu what other page on the website they want the post to go to. (For all of the things I'm discussing here, I've drawn out pictures of what I want in Illustrator if anyone needs specifications.) Once the user presses "Submit" or "Accept" or whatever, it will post their information on the page they selected, organized with the picture a certain size on the left, and the text aligned ragged right on the right side of the picture. Below that, each "post" will be assigned a number based on the last post made to that page. So if I was the first one to post it, it'd show "1" in the data. I can imagine this isn't a simple process, but because I understand how PHP works, and also how comment systems in server side coding works, I just need to know certain things in the code, like organizing the inputed data when posted and what not. Any help or advice would be greatly appreciated by both me and my partner. Thanks! How can i call a specific row when ever a like. example : Code: [Select] $record = mysql_query("select * from table_name"); ($getValue= mysql_fetch_row($record) //i'm not sure what should i use. should i use mysql_fetch_array, mysql_ fetch_ assoc, mysql_ fetch_ object, mysql_ field_ name and etc. print $getValue[$column_name][0]; 0 = value 1st row in the database/table_name 1 = value 2nd row in the database/table_name 2 = value 3rd row in the database/table_name ...... .... ...... ..... etc. is there a code i can do except from using sql_fetch_array then loop and put in into a multidimensional array? I've been searching for a couple of days on google using keywords, trying to figure out why this form sends blank emails. I've found several different ways to write something like this, including what's below, but for the life of me I haven't figured it out. Can anyone help a brother out? <?php $email = $_REQUEST['email']; $message = $_REQUEST['date']; $message .= $_REQUEST['location']; $message .= $_REQUEST['quantitymodel']; mail( "name@email.com", "Email Contact Form", $message, "From: $email" ); header( "Location: thankyou.html" ); ?> I'm trying to parse 2 things. 1. Specific TD tags from a table. 2. Specific URLs from an HTML page. Here's part of the data I'm trying to parse: Code: [Select] <tr> <td class="f"> <a href="http://main1.site.com/x.html">Page 1</a> </td> <td>1572</td> <td class="a">Type: F</td> <td><img src="http://site.com/image.gif" title="N" alt="N" /></td> <td class="f">F</td> </tr> <tr class="x"> <td class="m"> <a href="http://main2.site.com/x.html">Page 2</a> </td> <td>1771</td> <td class="a">Type: M</td> Here's the parser that I'm working with: Code: [Select] <?php $html = file_get_contents('http://www.website.com/page.html'); // use this to only match "td" tags #preg_match_all ( "/(<(td)>)([^<]*)(<\/\\2>)/", $html, $matches ); // use this to match any tags #preg_match_all("/(<([\w]+)[^>]*>)([^<]*)(<\/\\2>)/", $html, $matches); //use this to match URLs #preg_match_all ( "/http:\/\/[a-z0-9A-Z.]+(?(?=[\/])(.*))/", $html, $matches ); //use this to match URLs #preg_match_all ( "/<a href=\"([^\"]*)\">(.*)<\/a>/iU", $html, $matches ); preg_match_all ( "/<a href=\"([^\"]*)\">(.*)<\/a>/iU", $html, $matches ); for ( $i=0; $i< count($matches[0]); $i++) { echo "matched: " . $matches[0][$i] . "\n<br>"; echo "part 1: " . $matches[1][$i] . "\n<br>"; echo "part 2: " . $matches[2][$i] . "\n<br>"; echo "part 3: " . $matches[3][$i] . "\n<br>"; echo "part 4: " . $matches[4][$i] . "\n\n<br>"; } ?> What I'm trying to output is: Code: [Select] <a href="http://main1.site.com/x.html">Page 1</a> Hits: 1572 <a href="http://main2.site.com/x.html">Page 2</a> Hits: 1771 ...for the entire table What I've managed to get out of it so far are the "Hits" with the "td" snippet. What I can't figure out is how to extra the full: <a href="http://main.site.com/p#.html">Page #</a> So my question is how can I make it look for just "<a href="http://main#.......">Page #</a>"? Currently it looks for every URL, which is not what I need. same with trivago Welcome to www.trivago.com. trivago is available locally: Continue to trivago Australia or Stay on www.trivago.com Hello from the UK! We want to make sure you get to the right place, and noticed you appear to be visiting us from Australia. If you would prefer to visit our Australian site, please just follow the link below. Go to our Australian site comparethemarket.com.auhi professionals I was not sure where to exactly post this as I am not to sure if it is a php question. We are developing a new website for another country and are looking to geo target people with the country in mind for instance if I visit comparethemarket .com or comparethemarket uk from here in Australia a pop up window appears saying the following Hi guys
I'll try keep this simple
I have been given access to a betting xml feed which requires my IP to be whitelisted.
I have whitelisted my home IP and it works fine.
I have whitelisted an IP on server 1 (linux, cpanel), this works fine
I have whitelisted an IP on server 2 (linux, cpanel), this doesn't work and I get:
"simplexml_load_file failed to open stream: http request failed!"
The IP is definitely whitelisted but I think it is something to do with the server. What could be blocking this?
allow_url_fopen and allow_url_include are both on by the way
Many thanks
Sam
Hi guys, i was having an issue with dates and although it leans a bit more into MYSQL I was hoping i could get some help ive searched all over the net for this so I dont know if im not thinking on how to ask this correctly or can't find it, but ill be as detailed as possible and hope that helps.
Ok I have a table that shows when payment was received on past invoices dating back to say 1995; The company processes 'ALL' invoices every month on the 9th, so if anything comes in from the first to the ninth it will be processed that month on the ninth. If it comes in from the tenth to the thirtieth or thirty-first it will be processed the following month.
The table already has a "Received" date filed and now I want to create a column on the table called "Processed Date" (adding the column is no problem don't need help with that part) that shows me the date we processed the invoice.
I know i have to use the "Received" field (because it shows what day the invoice was put into the system) but im not sure how to format the "Processed Date" field, so say the "Received" field shows an invoice came in on '1995-05-11', I want the "Processed Date" field to display it was payed on '1995-06-09' (notice that is the following month).
I thought i would put in a visual of what I was trying to do below:
So if I pull the two columns in MYSQL from that table I would see something like this:
Received Processed Date
1996-02-03 1996-02-09
1996-03-03 1996-03-09
1996-04-11 1996-05-09
1996-05-20 1996-06-09
1996-07-13 1996-08-09
If i could get some guidance/help on this i would really appreciate it.
thanks in advance!!
JL
I have fopen() code that works fine.. Code: [Select] $filename = "trade.php"; $filehandle = fopen($filename, 'w') or die("can't open file"); fclose($filehandle); But I want it to create the file "trade.php" in a specific directory called "tradepages". I tried changing the one line to be... Code: [Select] $filename = ".../tradepages/trade.php"; But that just gives an error saying no such directory exists (even though it definitely does). There has to be a way to create files in whatever folder/directory you want, right? Anyone know how, or what I'm doing wrong? I am wondering if it's possible to get some data from another website via PHP? I would like to get data from website http://www.gamersfirst.com/warrock/?q=Player&nickname=soldier, and the exact data which I need is "Level" which is in this case 2. Can this value be grabbed and if it can, where can I get some info about how to do it? Hello all, I have a rather large array and I need to list it's contents in an alphabetical list. The array is built like this: $array['query']['row']['0']['title'] = 'Bob'; $array['query']['row']['1']['title'] = 'Andy'; $array['query']['row']['2']['title'] = 'Tom'; I need to sort it so it is in alphabetical order based on the title. Is there an easy way to do this? I'm wondering how I can find the x, y coordinates on an image in PHP where a specific colour lies. If there was a #000000 coloured pixel located on 127, 205, how could I use PHP to find the 127, 205 by just telling it #000000? Was just wondering if it's okay to make simple donations to other users on the forum. Just out of generosity.
If true, if I want to make a donation to a specific user how would I go about doing it? Just pm them asking for their paypal?
Edited by Monkuar, 12 October 2014 - 12:08 PM. Hi Guys, I am fairly new to mySQL/PHP and I have an issue. I have a login/registration system for a website and it works. However in the registration the user enters info such as their phone and email. How can I access these two fields of info from the user who is currently logged in. For example someone makes an account with: Username: Person Password: hello Email: person@gmail.com Phone: 111-111-1111 Name: Hello Person When they log into the site using their username and password, how can I detect their email/phone/name? Thanks in advance! New to PHP, I wrote a shortcode to use in WP that outputs a nav bar with some icons. One will link to a url, one to a pop up plugin (through a class), and one a phone number. The shortcode will then look like this [footer-btn url="link here "]Name of Icon Here[/footer-btn] Right now when I put the short codes into word press, I get duplicates of the URL ones. function footer_btn_function($atts, $content){ extract( shortcode_atts( array( 'class' => '', 'phone' => '', 'url' => '' ), $atts ) ); if($class){ '<a class="text-link" href='.$class.'><img class="popmake-73310 footer-btn mobile" src="'.get_template_directory_uri().'/images/faq-mobile-white.png">'.$content.'</a>'; } if($phone){ $output .= '<a class="text-link" href="tel:'.$phone.'" target="_blank"><img class="footer-btn mobile" src="'.get_template_directory_uri().'/images/phone-mobile-white.png">'.$content.'</a>'; }; if($url){ $output .= '<a class="text-link" href="tel:'.$url.'" target="_blank"><img class="footer-btn mobile" src="'.get_template_directory_uri().'/images/vacation-rentals-mobile-white.png">'.$content.'</a>'; }; if($url){ $output .= '<a class="text-link" href="tel:'.$url.'" target="_blank"><img class="footer-btn mobile" src="'.get_template_directory_uri().'/images/chat-mobile-white.png">'.$content.'</a>'; }; return $output; }
Hi All, I have the following code to find all the image src's for all the images within a current page. However I would like to adapt it so it only looks within the <div id="description">. Any ideas on how to do that? I have tried Googling with not much look. Code: [Select] <?php $url="http://www.example.com?id=1"; $html = file_get_contents($url); $doc = new DOMDocument(); @$doc->loadHTML($html); $images = $doc->getElementsByTagName('img'); foreach ($images as $image) { echo $image->getAttribute('src')."<br/>"; } ?> Cheers Guys! <?php class booking_diary { // Mysqli connection function __construct($link) { $this->link = $link; } // Settings you can change: // Time Related Variables public $booking_start_time = "09:00"; // The time of the first slot in 24 hour H:M format public $booking_end_time = "13:00"; // The time of the last slot in 24 hour H:M format public $booking_frequency = 02; // The slot frequency per hour, expressed in minutes. //$date = new DateTime(); //$Pdate-> setDate(2020, 10, 29); // Day Related Variables public $day_format = 1; // Day format of the table header. Possible values (1, 2, 3) // 1 = Show First digit, eg: "M" // 2 = Show First 3 letters, eg: "Mon" // 3 = Full Day, eg: "Monday" public $day_closed = array("Saturday", "Sunday"); // If you don't want any 'closed' days, remove the day so it becomes: = array(); //public $Special_day = array() public $day_closed_text = "CLOSED"; // If you don't want any any 'closed' remove the text so it becomes: = ""; // Cost Related Variables public $cost_per_slot = 20.00; // The cost per slot public $cost_currency_tag = "£"; // The currency tag in HTML such as € £ ¥ // DO NOT EDIT BELOW THIS LINE public $day_order = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"); public $day, $month, $year, $selected_date, $back, $back_month, $back_year, $forward, $forward_month, $forward_year, $bookings, $count, $days, $is_slot_booked_today; /*========================================================================================================================================================*/ function make_calendar($selected_date, $back, $forward, $day, $month, $year) { // $day, $month and $year are the $_GET variables in the URL $this->day = $day; $this->month = $month; $this->year = $year; // $back and $forward are Unix Timestamps of the previous / next month, used to give the back arrow the correct month and year $this->selected_date = $selected_date; $this->back = $back; $this->back_month = date("m", $back); $this->back_year = date("Y", $back); // Minus one month back arrow $this->forward = $forward; $this->forward_month = date("m", $forward); $this->forward_year = date("Y", $forward); // Add one month forward arrow // Make the booking array $this->make_booking_array($year, $month); } function make_booking_array($year, $month, $j = 0) { $stmt = $this->link->prepare("SELECT name, date, start FROM bookings WHERE date LIKE CONCAT(?, '-', ?, '%')"); $this->is_slot_booked_today = 0; // Defaults to 0 $stmt->bind_param('ss', $year, $month); $stmt->bind_result($name, $date, $start); $stmt->execute(); $stmt->store_result(); while($stmt->fetch()) { $this->bookings_per_day[$date][] = $start; $this->bookings[] = array( "name" => $name, "date" => $date, "start" => $start ); // Used by the 'booking_form' function later to check whether there are any booked slots on the selected day if($date == $this->year . '-' . $this->month . '-' . $this->day) { $this->is_slot_booked_today = 1; } } // Calculate how many slots there are per day $this->slots_per_day = 0; for($i = strtotime($this->booking_start_time); $i<= strtotime($this->booking_end_time); $i = $i + $this->booking_frequency * 60) { $this->slots_per_day ++; } $stmt->close(); $this->make_days_array($year, $month); } // Close function function make_days_array($year, $month) { // Calculate the number of days in the selected month $num_days_month = cal_days_in_month(CAL_GREGORIAN, $month, $year); // Make $this->days array containing the Day Number and Day Number in the selected month for ($i = 1; $i <= $num_days_month; $i++) { // Work out the Day Name ( Monday, Tuesday... ) from the $month and $year variables $d = mktime(0, 0, 0, $month, $i, $year); // Create the array $this->days[] = array("daynumber" => $i, "dayname" => date("l", $d)); } /* Sample output of the $this->days array: [0] => Array ( [daynumber] => 1 [dayname] => Monday ) [1] => Array ( [daynumber] => 2 [dayname] => Tuesday ) */ $this->make_blank_start($year, $month); $this->make_blank_end($year, $month); } // Close function function make_blank_start($year, $month) { /* Calendar months start on different days Therefore there are often blank 'unavailable' days at the beginning of the month which are showed as a grey block The code below creates the blank days at the beginning of the month */ // Get first record of the days array which will be the First Day in the month ( eg Wednesday ) $first_day = $this->days[0]['dayname']; $s = 0; // Loop through $day_order array ( Monday, Tuesday ... ) foreach($this->day_order as $i => $r) { // Compare the $first_day to the Day Order if($first_day == $r && $s == 0) { $s = 1; // Set flag to 1 stop further processing } elseif($s == 0) { $blank = array( "daynumber" => 'blank', "dayname" => 'blank' ); // Prepend elements to the beginning of the $day array array_unshift($this->days, $blank); } } // Close foreach } // Close function function make_blank_end($year, $month) { /* Calendar months start on different days Therefore there are often blank 'unavailable' days at the end of the month which are showed as a grey block The code below creates the blank days at the end of the month */ // Add blank elements to end of array if required. $pad_end = 7 - (count($this->days) % 7); if ($pad_end < 7) { $blank = array( "daynumber" => 'blank', "dayname" => 'blank' ); for ($i = 1; $i <= $pad_end; $i++) { array_push($this->days, $blank); } } // Close if $this->calendar_top(); } // Close function function calendar_top() { // This function creates the top of the table containg the date and the forward and back arrows echo " <div id='lhs'><div id='outer_calendar'> <table border='0' cellpadding='0' cellspacing='0' id='calendar'> <tr id='week'> <td align='left'><a href='?month=" . date("m", $this->back) . "&year=" . date("Y", $this->back) . "'>«</a></td> <td colspan='5' id='center_date'>" . date("F, Y", $this->selected_date) . "</td> <td align='right'><a href='?month=" . date("m", $this->forward) . "&year=" . date("Y", $this->forward) . "'>»</a></td> </tr> <tr>"; /* Make the table header with the appropriate day of the week using the $day_format variable as user defined above Definition: 1: Show First digit, eg: "M" 2: Show First 3 letters, eg: "Mon" 3: Full Day, eg: "Monday" */ foreach($this->day_order as $r) { switch($this->day_format) { case(1): echo "<th>" . substr($r, 0, 1) . "</th>"; break; case(2): echo "<th>" . substr($r, 0, 3) . "</th>"; break; case(3): echo "<th>" . $r . "</th>"; break; } // Close switch } // Close foreach echo "</tr>"; $this->make_cells(); } // Close function function make_cells($table = '') { echo "<tr>"; foreach($this->days as $i => $r) { // Loop through the date array $j = $i + 1; $tag = 0; // If the the current day is found in the day_closed array, bookings are not allowed on this day if(in_array($r['dayname'], $this->day_closed)) { echo "\r\n<td width='21' valign='top' class='closed'>" . $this->day_closed_text . "</td>"; $tag = 1; } // Past days are greyed out if (mktime(0, 0, 0, $this->month, sprintf("%02s", $r['daynumber']) + 1, $this->year) < strtotime("now") && $tag != 1) { echo "\r\n<td width='21' valign='top' class='past'>"; // Output day number if($r['daynumber'] != 'blank') echo $r['daynumber']; echo "</td>"; $tag = 1; } // If the element is set as 'blank', insert blank day if($r['dayname'] == 'blank' && $tag != 1) { echo "\r\n<td width='21' valign='top' class='unavailable'></td>"; $tag = 1; } // Now check the booking array $this->booking to see whether we have a booking on this day $current_day = $this->year . '-' . $this->month . '-' . sprintf("%02s", $r['daynumber']); if(isset($this->bookings_per_day[$current_day]) && $tag == 0) { $current_day_slots_booked = count($this->bookings_per_day[$current_day]); if($current_day_slots_booked < $this->slots_per_day) { echo "\r\n<td width='21' valign='top'> <a href='calendar.php?month=" . $this->month . "&year=" . $this->year . "&day=" . sprintf("%02s", $r['daynumber']) . "' class='part_booked' title='This day is part booked'>" . $r['daynumber'] . "</a></td>"; $tag = 1; } else { echo "\r\n<td width='21' valign='top'> <a href='calendar.php?month=" . $this->month . "&year=" . $this->year . "&day=" . sprintf("%02s", $r['daynumber']) . "' class='fully_booked' title='This day is fully booked'>" . $r['daynumber'] . "</a></td>"; $tag = 1; } // Close else } // Close if if($tag == 0) { echo "\r\n<td width='21' valign='top'> <a href='calendar.php?month=" . $this->month . "&year=" . $this->year . "&day=" . sprintf("%02s", $r['daynumber']) . "' class='green' title='Please click to view bookings'>" . $r['daynumber'] . "</a></td>"; } // The modulus function below ($j % 7 == 0) adds a <tr> tag to every seventh cell + 1; if($j % 7 == 0 && $i >1) { echo "\r\n</tr>\r\n<tr>"; // Use modulus to give us a <tr> after every seven <td> cells } } echo "</tr></table></div><!-- Close outer_calendar DIV -->"; if(isset($_GET['year'])) $this->basket(); echo "</div><!-- Close LHS DIV -->"; // Check booked slots for selected date and only show the booking form if there are available slots $current_day = $this->year . '-' . $this->month . '-' . $this->day; $slots_selected_day = 0; if(isset($this->bookings_per_day[$current_day])) $slots_selected_day = count($this->bookings_per_day[$current_day]); if($this->day != 0 && $slots_selected_day < $this->slots_per_day) { $this->booking_form(); } } // Close function function booking_form() { echo " <div id='outer_booking'><h2>Available Slots</h2> <p> The following slots are available on <span> " . $this->day . "-" . $this->month . "-" . $this->year . "</span> </p> <table width='400' border='0' cellpadding='2' cellspacing='0' id='booking'> <tr> <th width='150' align='left'>Start</th> <th width='150' align='left'>End</th> <th width='150' align='left'>Price</th> <th width='20' align='left'>Book</th> </tr> <tr> <td> </td><td> </td><td> </td><td> </td> </tr>"; // Create $slots array of the booking times for($i = strtotime($this->booking_start_time); $i<= strtotime($this->booking_end_time); $i = $i + $this->booking_frequency * 60) { $slots[] = date("H:i:s", $i); } // Loop through $this->bookings array and remove any previously booked slots if($this->is_slot_booked_today == 1) { // $this->is_slot_booked_today created in function 'make_booking_array' foreach($this->bookings as $i => $b) { if($b['date'] == $this->year . '-' . $this->month . '-' . $this->day) { // Remove any booked slots from the $slots array $slots = array_diff($slots, array($b['start'])); } // Close if } // Close foreach } // Close if // Loop through the $slots array and create the booking table foreach($slots as $i => $start) { // Calculate finish time $finish_time = strtotime($start) + $this->booking_frequency * 60; echo " <tr>\r\n <td>" . $start . "</td>\r\n <td>" . date("H:i:s", $finish_time) . "</td>\r\n <td>" . $this->cost_currency_tag . number_format($this->cost_per_slot, 2) . "</td>\r\n <td width='110'><input data-val='" . $start . " - " . date("H:i:s", $finish_time) . "' class='fields' type='checkbox'></td> </tr>"; } // Close foreach echo "</table></div><!-- Close outer_booking DIV -->"; } // Close function function basket($selected_day = '') { if(!isset($_GET['day'])) $day = '01'; else $day = $_GET['day']; // Validate GET date values if(checkdate($_GET['month'], $day, $_GET['year']) !== false) { $selected_day = $_GET['year'] . '-' . $_GET['month'] . '-' . $day; } else { echo 'Invalid date!'; exit(); } echo "<div id='outer_basket'> <h2>Selected Slots</h2> <div id='selected_slots'></div> <div id='basket_details'> <form method='post' action='book_slots.php'> <label>Name</label> <input name='name' id='name' type='text' class='text_box'> <label>Email</label> <input name='email' id='email' type='text' class='text_box'> <label>Phone</label> <input name='phone' id='phone' type='text' class='text_box'> <div id='outer_price'> <div id='currency'>" . $this->cost_currency_tag . "</div> <div id='total'></div> </div> <input type='hidden' name='slots_booked' id='slots_booked'> <input type='hidden' name='cost_per_slot' id='cost_per_slot' value='" . $this->cost_per_slot . "'> <input type='hidden' name='booking_date' value='" . $_GET['year'] . '-' . $_GET['month'] . '-' . $day . "'> <input type='submit' class='classname' value='Make Booking'> </form> </div><!-- Close basket_details DIV --> </div><!-- Close outer_basket DIV -->"; } // Close function } // Close Class ?> Edited October 29, 2020 by requinix please use the Code <> button when posting code Hey guys. How do you remove a specific element from an array? Lets say I have a string like this: $list = "guy,girl,boy,man,woman,lady"; Then I use explode to break it up into an array by commas: $listArray = explode(",",$list); Now $listArray contains everything. Now if I wanted to delete something specific from that array, how would I do that? So for example, I want to delete "man" out of the array. How do I do that without know its key? I have this code that will get the absent dates for all employees, how can i make it for one specific employee using oracle id? code: $res = $conn->query("SELECT s.oracleid , s.staffname , date_format(date, '%W %d/%m/%Y') as absent FROM staff s CROSS JOIN date d LEFT JOIN attendance_records a ON s.oracleid = a.oracleid AND d.date = DATE(a.clockingindate) WHERE a.oracleid IS NULL ORDER BY s.oracleid, d.date "); the records i am concerned about is for the attendance records table, I have oracle id in that table. |