PHP - Include() Options?
I am new to PHP and wasting no time have jumped into creating my own database system. Its actually a psuedo-database, but who cares it works. I've done something some-what similar in Python but with a static single file database.
What I have is directories as like: ./1/index.listing ./2/index.listing ./3/index.listing The numbers are a product... product 1, product 2, you know.. What I want to do is on the product category page, using: Code: [Select] include('./*/index.listing');.. where * would mean for PHP to scan all relative directories and include 'index.listing', which will result in a list being built for the product category, showing all the available products. There is probably some way to do this in MySQL, but I am already familiur with this style of database, so why waste more Saturday nights learning something I don't have to when I could be out getting drunk and partying with girls 10 years younger than me. LuLz Similar TutorialsHi Guys.. Merry Christmas Im kinda new to this fantastic world of PHP and i have a little problem i hope you can help me with. Im trying to build a website where I use include() to genereate my content. On my index.php i have a menu which includes content in a content div from external .php pages, my structure kinda goes like this.. (simplified) site/ index.php content/ fronpage.php products.php contact.php The HTML looks like this. <div id="menu"> <ul> <li><a href="index.php?page=frontpage">frontpage</a></li> <li><a href="index.php?page=products">frontpage</a></li> <li><a href="index.php?page=contact">frontpage</a></li> </ul> </div <div id="main"> <?php include('/content/'.$_GET['page'].'.php'); ?> </div> This all works very fine, but my problem is, can I have a include inside an already included page? I would like to have a menu on my products.php site, but that page is already included from above, and i would like the menu on the products.php site to stay as the content from the nested include changes with input from the /products folder. my idea was something like this. site/ index.php content/ frontpage.php products.php contact.php products/ product1.php product2.php the HTML on the index.php is the same as above and then i would add the include() on the products.php page, so its kinda the same thing, but one inside the other. HTML inside the products.php folder <div id="sub_menu"> <ul> <li><a href="#">frontpage</a></li> <li><a href="#">frontpage</a></li> <li><a href="#">frontpage</a></li> </ul> </div <div id="sub_main"> <?php include('/content/products'.$_GET['#'].'.php'); ?> </div> I dont know how to link to the new files so they will be included while the first include still stays on the page. Any of you know how and if this can be done? Or maybe at better way to do it? Hope this made sense, my first PHP question Thanks CanI put one INCLUDE statement INSIDE of another INCLUDE statement? Hi Still a new comer when it comes to PHP. I have a situation where I want to use an include within an include and I am having trouble with my file paths. My main header include, includes everything for each page of my site, beyond the opening of the body to incorporate my navigation etc conditionally loading in css, and loading in titles and meta data etc depending on the page in question. This header needs to reference another include called the-pod.php which is required for every page, the only trouble is I want to use / to reference the root of the server and this is breaking my code. I can't use ../../ etc as its a different path depending on where the master file is located. So my question is how do I get around this? Can the root of the server or path to the root be stored in a variable? and if so how would I write this. Any tips / advice will be greatly appreciated. Hello, I'm just learning php (by force), but am pretty well versed in html and css. I did not rite the following code and I'm not sure how to pull out the php in the following in order to make the page validate. <tr> <td width="15%"><b><b>Priority</b></td> <td> <select name="priority" size="1" value="priority"> <option value="" <?php if ($row['priority'] == "") echo " selected";?> ></option> <option value="Normal" <?php if ($row['priority'] == "Normal") echo " selected";?> >Normal</option> <option value="Elevated" <?php if ($row['priority'] == "Elevated") echo " selected";?> >Elevated</option> <option value="STAT" <?php if ($row['priority'] == "STAT") echo " selected";?> >STAT</option> </select> </td> </tr> The idea is to prefetch the "priority" info and populate the drop down with that. Afterwards, the user can change the value and once submitted, the value will change in the database. Any pointers would be appreciated - and thanks in advance. Rich Hi,
I haven't worked with PHP in years and was asked to debug something. Maybe you can help me out since I'm stuck. This error popped up when we upgraded from PHP 5.3 to 5.4.
It is setting LDAP options.
Here is the code:
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0) or die ("Could not set option referrals"); Both of these statement are throwing the following error message to the log. 52 is not a valid ldap link resource Anything I can check or look at? I am a little clueless here. Thanks Hi I have this serach function, wich searches on site by a lot of parameters at the same time (titolo, titolo2, attore1,etc...) , but I want to make them options, so you would have a search field and an options dropdown menu. Can anyone help me with this? My code follows: PHP Code: [Select] function jm_search(){ global $database, $sstring, $my, $cinConfig, $Itemid, $option, $mainframe; $tl_title = _JMOVIES_SEARCHRESULT." ".$sstring; $suchstring = trim( strtolower( $sstring ) ); $query1 = "SELECT * FROM #__jmovies WHERE" ."\n (titolo LIKE '%".$suchstring."%'" ."\n OR titolo2 LIKE '%".$suchstring."%'" ."\n OR attore1 LIKE '%".$suchstring."%'" ."\n OR attore2 LIKE '%".$suchstring."%'" ."\n OR attore3 LIKE '%".$suchstring."%'" ."\n OR attore4 LIKE '%".$suchstring."%'" ."\n OR nazione LIKE '%".$suchstring."%'" ."\n OR regista LIKE '%".$suchstring."%'" ."\n OR descrizione LIKE '%".$suchstring."%'" ."\n OR anno LIKE '%".$suchstring."%') AND published = 1 AND access <= ".(int)$my->gid." ORDER BY titolo"; $database->setQuery($query1); //echo $database->getQuery(); $rows = $database->loadObjectList(); if(is_file($mainframe->getCfg('absolute_path')."/components/".$option."/templates/".$cinConfig['template']."/show_search_tpl.php")) require($mainframe->getCfg('absolute_path')."/components/".$option."/templates/".$cinConfig['template']."/show_search_tpl.php"); else require($mainframe->getCfg('absolute_path')."/components/".$option."/templates/default/show_search_tpl.php"); } HTML Code: [Select] <td width="44%" valign="middle" bgcolor="#eeeeee" style="text-align:right"> <input name="sstring" type="text" class="jmoviesInputSearch" title="<?php echo _JMOVIES_SEARCH?>" onfocus="if(this.value=='<?php echo _JMOVIES_SEARCH?>') this.value='';" onblur="if(this.value=='') this.value='<?php echo _JMOVIES_SEARCH?>';" onchange="javascript:document.jmoviesSearchForm.submit();" value="<?php echo _JMOVIES_SEARCH?>" size="50"/><input type="submit" value="OK" class="button"/></td> Thank you. I have 3 basic questions. I did a few Google Searches for this data and could not find anything substantion. What options are available to somewho who wants to send notifications to a Desktop PC (main thing), Android phone, and maybe a few other phone types. The main thing I need to figure out is about desktop notifications. I heard that GMail was about to release this feature soon, so I know there must be options out there for it. Are there any options, besides a standard custom desktop application development? Is this a mistake in the documentation? I am running PHP7.4 and get warning: unserialize() expects parameter 2 to be array, bool given. QuoteEither an array of class names which should be accepted, false to accept no classes, or true to accept all classes. If this option is defined and unserialize() encounters an object of a class that isn't to be accepted, then the object will be instantiated as __PHP_Incomplete_Class instead. Omitting this option is the same as defining it as true: PHP will attempt to instantiate objects of any class.
Old issue of mine that I'm coming back to. My question is I'm trying to figure out how to work with the select box of options and apply button so that if delete is chosen and the user clicks on apply it performs the deletedivision inside the process page I know it deals with jquery's ajax however this part of it does not that I'm trying to get fixed because as of right now I have if (isset($_POST['deletedivision'])) and I know that's not right and I know I can't apply a name to the option tag because name isn't one of option's allowable attributes. mods/divisions.php Code: [Select] <form action="" method="post"> <label for="actionSelect">With selected items: </label> <select class="select" name="actionSelect" id="actionSelect"> <option id="1">Edit</option> <option id="2">Delete</option> </select> <button class="button small-button"><strong>Apply</strong></button> </form> <?php while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { echo ' <tr> <td><input type=checkbox class=checkbox name=checkbox[] id=checkbox[] value="' . $row['id'] . '" /></td> <td>' . $row['divisionname'] . '</td> <td>' . $row['name'] . '</td> <td class=last>' . $row['datecreated'] . '</td> </tr>'; } ?> processes/divisions.php if (isset($_POST['deletedivision'])) { $checkbox = $_POST['checkbox']; $countCheck = count($_POST['checkbox']); for($i=0;$i<$countCheck;$i++) { $del_id = $checkbox[$i]; $query = "DELETE from `divisions` where id = $del_id"; mysqli_query($dbc,$query); } } Why dos this loop not split up after 15 options? Code: [Select] $count = 0; $maxPerList = 15; echo '<ul style="list-style: none; padding-left: 0px; margin: 0px; "><li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3"> '; echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text']; echo "<ul>"; foreach($products_options_name as $currValue) { if($count == $maxPerList) { echo "</ul>"; echo "<ul>"; $count = 0; } echo "</li>"; $count++; echo "</ul>";all the file Code: [Select] <?php /* $Id$ adapted for Separate Pricing Per Customer v4.2 2007/06/23 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query); // BOF Separate Pricing per Customer if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') { $customer_group_id = $_SESSION['sppc_customer_group_id']; } else { $customer_group_id = '0'; } // EOF Separate Pricing per Customer require(DIR_WS_INCLUDES . 'template_top.php'); if ($product_check['total'] < 1) { ?> <div class="contentContainer"> <div class="contentText"> <?php echo TEXT_PRODUCT_NOT_FOUND; ?> </div> <div style="float: right;"> <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?> </div> </div> <?php } else { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { // BOF Separate Pricing per Customer if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; } } // end if ($customer_group_id > 0) // EOF Separate Pricing per Customer $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { // BOF Separate Pricing per Customer if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; } } // end if ($customer_group_id > 0) // EOF Separate Pricing per Customer $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; } ?> <?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?> <div> <style="float: right;"><?php echo $products_price; ?> <h1><?php echo $products_name; ?></h1> </div> <div class="contentContainer"> <div class="contentText"> <?php if (tep_not_null($product_info['products_image'])) { $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order"); if (tep_db_num_rows($pi_query) > 0) { ?> <div id="piGal" style="float: right;"> <ul> <?php $pi_counter = 0; while ($pi = tep_db_fetch_array($pi_query)) { $pi_counter++; $pi_entry = ' <li><a href="'; if (tep_not_null($pi['htmlcontent'])) { $pi_entry .= '#piGalimg_' . $pi_counter; } else { $pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image']); } $pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>'; if (tep_not_null($pi['htmlcontent'])) { $pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>'; } $pi_entry .= '</li>'; echo $pi_entry; } ?> </ul> </div> <script type="text/javascript"> $('#piGal ul').bxGallery({ maxwidth: 300, maxheight: 200, thumbwidth: <?php echo (($pi_counter > 1) ? '75' : '0'); ?>, thumbcontainer: 300, load_image: 'ext/jquery/bxGallery/spinner.gif' }); </script> <?php } else { ?> <div id="piGal" style="float: right;"> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), null, null, 'hspace="5" vspace="5"') . '</a>'; ?> </div> <?php } ?> <script type="text/javascript"> $("#piGal a[rel^='fancybox']").fancybox({ cyclic: true }); </script> <?php } ?> <?php echo stripslashes($product_info['products_description']); ?> <?php // BOF SPPC Hide attributes from customer groups $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 "); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { ?> <p><?php echo TEXT_PRODUCT_OPTIONS; ?></p> <p> <!-- // Code segment includes/modified for Multiple product option lines. // maintainance and Qns : Harishyam :> feenix_666@yahoo.com --> <?php if ($products_options_total['total'] == 1) { for($i=0;$i<$products_attributes['total'];$i++) { $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0"); $list_of_prdcts_attributes_id = ''; $products_options = array(); // makes sure this array is empty again while ($_products_options = tep_db_fetch_array($products_options_query)) { $products_options[] = $_products_options; $list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].","; } if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")"; $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'"); while ($pag_array = tep_db_fetch_array($pag_query)) { $cg_attr_prices[] = $pag_array; } // substitute options_values_price and prefix for those for the customer group (if available) if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) { for ($n = 0 ; $n < count($products_options); $n++) { for ($i = 0; $i < count($cg_attr_prices) ; $i++) { if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) { $products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix']; $products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price']; } } // end for ($i = 0; $i < count($cg_att_prices) ; $i++) } } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices)) } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') for ($n = 0 ; $n < count($products_options); $n++) { $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']); if ($products_options[$n]['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } // EOF SPPC attributes mod if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <?php $count = 0; $maxPerList = 15; echo '<ul style="list-style: none; padding-left: 0px; margin: 0px; "><li style="list-style: none; "><input type="text" name='.$i.'_quantity value="" style="text-align:right;" size="3">&#8194;'; echo tep_draw_hidden_field($i.'_id[' . $products_options_name['products_options_id'] . ']', $products_options_array[$i]['id']) . $products_options_array[$i]['text']; echo "<ul>"; foreach($products_options_name as $currValue) { if($count == $maxPerList) { echo "</ul>"; echo "<ul>"; $count = 0; } echo "</li>"; $count++; echo "</ul>"; }} } // End of loop } else { //do your regular thing $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } } ?> <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br /> <?php } ?> </p> <?php } ?> <div style="clear: both;"></div> <?php if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <p style="text-align: center;"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></p> <?php } ?> </div> <?php $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and reviews_status = 1"); $reviews = tep_db_fetch_array($reviews_query); ?> <div class="buttonSet"> <span class="buttonAction"><?php if ($products_options_total['total'] != 1) { echo 'Enter Quantity: ' . tep_draw_input_field('cart_quantity','1','size="3" style="text-align:right;"') . ' ' ; } ?> <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span> </div> <?php if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } ?> </div> </form> <?php } require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> I accidently posted this in the PHP applications board and didn't mean to because its a blizzard here and my comp is getting slow and lagging and I thought I had clicked in the right board but I was wrong so if a mod, admin can delete that other entry I'd be thankful. I'm trying to queries together because I have this query but I want to only put in those characters that have not been taken so I have another table that lists all the characters that are used. TABLE handler_characters which has fields called id, handler_id, character_id. What I want to somehow do is have it get all the character_ids out of that table and then subtract those ids from this query so it won't list them as options. Any thoughts on how to accomplish this? <?php $query = 'SELECT id, charactername FROM characters ORDER BY `charactername`'; $result = mysqli_query ( $dbc, $query ); // Run The Query while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { print "<option value=\"".$row['id']."\">".$row['charactername']."</option>\r"; } ?> Hi.. Im generating daily reports for employees I have to give PRINT AND SAVE AS PDF button ..how to implement this.. Any code for this in php Thanx in Advance I've been working on JSON and have found a way to send variables from the PHP to the JavaScript using AJAX and no JQuery. For an ecommerce site does it make more sense to send the variables : description, title, cost, etc. to the JavaScript page, or would it make more sense to echo the html on the PHP page? The idea, right now, is a product page for editing and deleting product. Thanks, Josh Edited December 22, 2020 by JoshEirHello PHPFreaks, I am busy with creating a search script that will search the database. I got it working so far but i want it to search for not only one thing but several things so actually make options in the form that you you choose only to search on name or only on address. How do i do this? The PHP code: Code: [Select] <?php mysql_connect ("localhost", "username","password") or die (mysql_error()); mysql_select_db ("database table"); $term = $_POST['term']; $sql = mysql_query("select * from databasetable where naam like '%$term%'"); while ($row = mysql_fetch_array($sql)){ echo "<center>"; echo "<table width='600px'>"; echo "<tr>"; echo "<td><b>Naam:</b> </td><td>".$row['naam']; echo "</td><td><b>Telefoon:</b> </td><td>".$row['telefoon']; echo "</td></tr><tr>"; echo "<tr>"; echo "<td><b>Adres:</b> </td><td>".$row['adres']; echo "</td><td><b>Mobiel:</b> </td><td>".$row['mobiel']; echo "</td></tr><tr>"; echo "<tr>"; echo "<td><b>Postcode:</b> </td><td>".$row['postcode']; echo "</td><td><b>E-mail:</b> </td><td>".$row['email']; echo "</td></tr><tr>"; echo "<tr>"; echo "<td><b>Woonplaats:</b> </td><td>".$row['woonplaats']; echo "</td></tr>"; echo "</table>"; echo "<br /><br />"; echo "<table width='400px'>"; echo "<tr>"; echo "<td><b>Datum:</b> </td><td>".$row['datum']; echo "</td></tr><tr><td><b>Probleem:</b> </td><td>".$row['probleem']; echo "</td></tr><tr>"; echo "<td><b>Mogelijke oplossing:</b> </td><td>".$row['oplossing1']; echo "</td></tr><tr><td><b>Oplossing:</b> </td><td>".$row['oplossing2']; echo "</td></tr><tr>"; echo "<td><b>Wachtwoord:</b> </td><td>".$row['wachtwoord']; echo "</td><tr><td><b>Geschatte Prijs:</b> </td><td>".$row['prijs']; echo "</td></tr><tr>"; echo "<td><b>Bijgeleverd:</b> </td><td>".$row['bijgeleverd']; echo "</td></tr>"; echo "</table><br />"; echo "---------------------------------------------------------------------------------------"; echo "</center>"; echo "<br/><br/>"; } ?> HTML Form: Code: [Select] <form action="search.php" method="post"> <b>RMA Zoeken:</b><br /> <input type="text" name="term" /><br /><br /> <input type="submit" class="art-button" name="submit" value="Submit" /> </form> This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=359241.0 I'm creating a blog for my wife. I've been a programmer for 15 years or so, but I have always avoided file upload due to fear of the security risks. I want to allow guests at my wife's website to upload photos. I have done a lot of research, but I can't really find a solution that takes away the anxiety. I've looked into a few cdn's such as cloudshare and amazon s3, but their services seem like overkill for just wanting to be able to display pictures for her blog. I'm just curious if anyone has any suggested routes, tutorials, or personal experiences. It seems most sites offer image uploads, I feel like it shouldn't be that complicated in 2019. The link below seems to make the most sense, but I haven't found a whole lot like it, and that was written four years ago. I host all my clients on subdomains, and most of my work is geared towards inventory which is why I have stayed away from file uploads. https://paragonie.com/blog/2015/10/how-securely-allow-users-upload-files When I put this above all else in my document and test it offline, all I see is code in the browser. But when I test it on my web server, I can view the markup and whatnot. Does anyone know why this is? Hi there, Im trying to build a drop down menu that has an if statement to determine the results, heres the code below: Code: [Select] <option value="<?php echo $row_Planet['PlanetName']?>"<?php if ($row_Planet['PlanetName'] == 'Mon Calamari'){ echo"Yavin"; echo"Denab";) ?><?php echo $row_Planet['PlanetName']?></option> Im really unsure of the syntax. If you could help that would be ace! Thanks Okay so I'm trying to come up with as many alternative methods to accomplish something. So I'm just seeking input from anyone who is willing to supply some. After the user clicks on a match type it'll know HOW MANY sides to the match there are so say for a singles match it'd have 2 sides (1 vs. 1) for a Triple Threat Match it'd have 3 sides (1 vs. 1 vs. 1) and so on. All matches have a stored field in the database of how many sides they have. So I'm thinking that I could have it create 3 divs (or something) down in the competitors area of how many sides there are in the match (separated by a VS. text block) and when the user selects a character from the dropdown and adds a character the user can maybe drag and drop the character's name to whatever side they choose. Its one idea. If you think of an EASIER more EFFICIENT way to do something like this and have an idea say something please or even if you can't let me know that you think it's a worth while idea. Code: [Select] <label for="matchtypedrop<?php echo $i+1 ?>">Match Type:</label> <select class="dropdown" name="matchtypedrop<?php echo $i+1 ?>" id="matchtypedrop<?php echo $i+1 ?>" title="Match Type <?php echo $i+1 ?>"> <option value="0">- Select -</option> <?php $query = 'SELECT id, matchtype FROM matchtypes'; $result = mysqli_query ( $dbc, $query ); // Run The Query while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { print "<option value=\"".$row['id']."\">".$row['matchtype']."</option>\r"; } ?> </select> <label for="competitors<?php echo $i+1 ?>">Competitors:</label><ul id="competitors<?php echo $i+1 ?>" style="list-style: none; margin-left: 195px;"></ul> <select class="dropdown" name="charactersdrop<?php echo $i+1 ?>" id="charactersdrop<?php echo $i+1 ?>" title="Characters Dropdown <?php echo $i+1 ?>" style="margin-left: 195px;"> <option value="0">- Select -</option> <?php $query = 'SELECT id, `character` FROM characters ORDER BY `character`'; $result = mysqli_query ( $dbc, $query ); // Run The Query while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { print "<option value=\"".$row['id']."\">".$row['character']."</option>\r"; } ?> </select> <input type="button" value="Add Character" class="" onclick="Competitors(<?php echo $i+1 ?>)"/> |