Jump to content

tryingtolearn

Members
  • Posts

    293
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by tryingtolearn

  1. You say its just hanging - do you get any error pages? if your server has mod_security running I believe there is a file upload size limit there If its a shared server you may have to talk to your server folks to see if it can be changed (safely).
  2. is that the complete upload script you are using?
  3. The result is an array so without a loop you will only get 1 result replace $row = mysqli_fetch_row($result); echo $row[0]."<br>"; echo $row[1]."<br>"; echo $row[2]."<br>"; with /* fetch associative array */ while ($row = mysqli_fetch_row($result)) { echo $row[0]."<br />"; }
  4. I might be able to work that in as a comparison of sorts at the end. The actual "randomness" is the key. The goal of the exercise is for a team to review the schedule and dedicate their teams resources accordingly. Measuring that ability is what I am after. The events are made up of various logic and physical activities so they need to be able to assign the right people at the right times taking those breaks into consideration. Mainly Im measuring the ability to put together the right team for the given task actually completing the tasks is secondary if that makes sense.
  5. Take a look in templates/default.php.
  6. That works out perfect Barand Much appreciated!
  7. Thanks for that Barand!! I was working on this a good part of today and came up with a method The downfall to mine is I have to adjust the last element of the array to get it to the 1440 (Minutes of the day) so I didnt like that. //events $events = range(7, 38, 0.01); shuffle($events); //breaks $breaks = range(0.5, 5.5, 0.01); shuffle($breaks); $ae = array_sum ($events) / count($events); $ab = array_sum($breaks) / count($breaks); $k = floor((24*60)/($ae+$ab)); $theDay = array(); $c=0; while ($c <= $k) { $c++; $theDay[]=$events[$c]; $theDay[]=$breaks[$c]; } if(array_sum($theDay) != 1440){ if(array_sum($theDay) < 1440){ $diff = (1440-array_sum($theDay)); $theDay[]=$diff; } if(array_sum($theDay) > 1440){ while (array_sum($theDay) > 1440) { $num=count($theDay); $num=$num-1; unset($theDay[$num]); } $diff = (1440-array_sum($theDay)); $theDay[]=$diff; } } I tested yours and it smooth but on some teams it falls shy of the 1440 so I have to see how that pans out when I try and figure out how to deploy these results to a timer. I appreciate you taking the time and thanks for the first post because it got me thinking and trying different things. My attempt seems alot less efficient than yours but I was trying hahaha Thanks again!
  8. if possible it would be good but isnt necessary
  9. Thanks for that The part I cannot figure out is how to generate the 57 events because it stops generating at 31 (Due to the range)
  10. No Guess I should have explained that better for instance Event 1 = 7 minutes / break after Event 1 = 2 minutes 30 seconds Event 2 = 24 minutes / break after Event 2 = 3 minutes 24 seconds Event 3 = 9 minutes 14 seconds / break after Event 3 = 1 minute and so on until the times (Events + Breaks) fill a 24 hour period The number of events and number of breaks do not matter, it is determined from the minimum and maximum set for the ranges of both events and breaks but has to fill a 24 hour period Then each team will complete each event just in different orders So Team 1 might do Event 3 then go to Event 1 then to Event 2 Team 2 might do Event 2 then go to Event 3 then to Event 1 Team 3 might do Event 3 then go to Event 2 then to Event 1 and so on -------- All the events run simultaneous from 12:00a.m. to 11:59p.m. but each team will do them in different orders some overlap is ok but I cant have all teams doing each event at the same time/order. Hopefully that makes more sense.
  11. Each event involves a single team but each team will eventually do each event if that makes sense Along the lines of a relay race sort of... Each team starts at a different station (event) has to complete it in that time-frame and has the break period until going on to the next station (event).
  12. I am trying to wrap my head around the best approach to accomplish this. I am trying to come up with a random schedule for a full 24 hour day with random time periods ranges including breaks. The only constants will be the minimum time and maximum time of the events and the minimum and maximum time of the breaks between each event. for example There are three teams Team A Team B Team C Each event will last either a minimum of 7 minutes to a maximum of 38 minutes The breaks will last a minimum of 30 seconds to a maximum of 5 minutes. so the events need to be generated randomly with a break period following each event and the timelines are different for each team with the current event time left going to a timer on the page I think I have the part to generate the random blocks figured out by using <!DOCTYPE html> <html> <body> <?php function eventRange($min, $max, $blocks) { $events = range($min, $max); shuffle($events); return array_slice($events, 0, $blocks); } function breakRange($min, $max, $blocks) { $breaks = range($min, $max, 0.1); shuffle($breaks); return array_slice($breaks, 0, $blocks); } echo"<pre>"; print_r( eventRange(7,38,32) ); echo"</pre>"; echo"<pre>"; print_r( breakRange(.5,5,32) ); echo"</pre>"; ?> </body> </html> bur is there a way to make it fill a full 24 hour period and then a way to determine which block to display based on the current time when either team is viewing the page. Sounds totally confusing to me as I try to explain it so I hope what Im asking makes sense. Thanks for any guidance..
  13. Thanks Kinda what I was thinking just wanted put the feelers out to see if I was overlooking the obvious (Known to do that every once in a while). Like the update as well. Thanks for taking the time.
  14. I am looking for some advice on the best way to maintain an options system. I have a list of items (In a mysql table) that make up options or packages that can be ordered For example Combo 1 comes with -List Item Orange -List Item Grape -List Item Brick Combo 2 comes with -List Item Grape -List Item Salmon -List Item Tiger Combo 3 comes with -List Item Orange -List Item Brick -List Item House -List Item Red -List Item Blue -List Item Car -List Item Boat -List Item Plane etc... The issue is that the list items have to be displayed in a specific order and new list items are added on regular intervals and others are deleted. I was going to add a column to the DB with a # order so I could just ORDER the result based off that but say there are 30 items and I need to add a new item in position 2 everything below it needs to be renumbered. Is there a better approach to this system? Any advice is appreciated, thanks
  15. Really odd one off problem I ran into today and Im trying to find out what causes it. Using an image rezize script that works fine Pass the image via the url and it resizes I had a set of images named Echo-1.jpg,Echo-2.jpg etc... Those images would not show, and if I put the url directly in the browser it gave me a Error 501 Not implemented error If I change Echo- to Echo2- it works??? So //does not work <img src="resizeTest/bdgDev/resize_image.php?image=Echo-Neutral-Alpha.jpg&new_width=100&new_height=100"> //works <img src="resizeTest/bdgDev/resize_image.php?image=Echo2-Neutral-Alpha.jpg&new_width=100&new_height=100"> Is there some signifigance to the word Echo wih a - that anyone ever ran into before? Just really curious to get some input from the forum - just an odd case I havent ran across before.
  16. Worked perfect, thanks alot for ttat When I read it, it seems liike its saying that the A and B have to be true to redirect, I guess thats why I wasnt figuring it out. Thanks for taking the time.
  17. Looking for an explanation I have three different user levels and I want to grant page access depending on the level. Say the levels are: Level A Level B Level C On this page I only want Levels A and B to access it I have it working by checking the Session value like this if ($_SESSION['user_level'] != 'A'){ if ($_SESSION['user_level'] != 'B'){ //redirect to the restricted page notice } } But it wouldnt work by doing any variation on one line in the if statement?? i.e. if (!isset($_SESSION['user_level']) || ($_SESSION['user_level'] != 'A')|| ($_SESSION['user_level'] != 'B')) { //redirect to the restricted page notice } it simply redirects everyone. Is there a way to get it on lne line vs. nesting the if statements - just out of curiosity.. THanks
  18. Works perfect, I wasnt adding anything in the second cll to the function but now that I see it it makes sense!! Thanks for taking the time. I appreciate the help.
  19. Been using a function I found here a while back for listing categories and sub categories and it works perfect. function listSubcats ($parent, $level=0){ global $abc; $sql = "SELECT id, title FROM Cat WHERE parent = $parent"; $res = mysqli_query($abc, $sql); while (list($id, $title) = $res->fetch_row()) { $indent = str_repeat('-', $level); echo "<OPTION value='$id'>$indent $title</OPTION>\n"; listSubcats ($id, $level+1); // list its subcats } } But this is the first time I need change the way the results are displayed. And that leads me to realizing I am a bit confused on how list really works. The mysql table has the typical ID, CatName, parent I need to have each Cat with all subcats related to it listed in its own div. But whatever I try I cannot get the placements of the opening and closing divs in the right spots. So can anyone tell if its even possible to do it with this function. I did work it out using multiple queries but then read on alot of forums that queries inside while statements is not good. Just looking for he best (Correct) way of geting the results laid out properly. like this <div class="one-third column"> Cat1 </div> <div class="one-third column"> Cat 2 </div> <div class="one-third column"> Cat 3 - Subcat 1 - Subcat 2 -- Sub Subcat 1 </div> <div class="one-third column"> Cat 4 </div> Hope that makes sense... Thanks for any guidance.
  20. Think I got it $mailService=$price->list[0]->mailservice; $mailRate=$price->list[0]->rate; Always seems like I figure it out right after posting a question and pulled all my hair out. Go figure
  21. Hi all, I really need some help getting values from the usps api Well not getting them but using them. I get the values but I need to extract the info to use in a form. This is the class im using <?php require_once("xmlparser.php"); class USPS { var $server = "http://testing.shippingapis.com/ShippingAPITest.dll"; var $user = "****"; var $pass = "****"; var $service = ""; var $dest_zip; var $orig_zip; var $pounds; var $ounces; var $container = "None"; var $size = "REGULAR"; var $machinable; var $country = "USA"; function setServer($server) { $this->server = $server; } function setUserName($user) { $this->user = $user; } function setPass($pass) { $this->pass = $pass; } function setService($service) { /* Must be: Express, Priority, or Parcel */ $this->service = $service; } function setDestZip($sending_zip) { /* Must be 5 digit zip (No extension) */ $this->dest_zip = $sending_zip; } function setOrigZip($orig_zip) { $this->orig_zip = $orig_zip; } function setWeight($pounds, $ounces=0) { /* Must weight less than 70 lbs. */ $this->pounds = $pounds; $this->ounces = $ounces; } function setContainer($cont) { $this->container = $cont; } function setSize($size) { $this->size = $size; } function setMachinable($mach) { /* Required for Parcel Post only, set to True or False */ $this->machinable = $mach; } function setCountry($country) { $this->country = $country; } function getPrice() { if($this->country=="USA"){ // may need to urlencode xml portion $str = $this->server. "?API=RateV2&XML=<RateV2Request%20USERID=\""; $str .= $this->user . "\"%20PASSWORD=\"" . $this->pass . "\"><Package%20ID=\"0\"><Service>"; $str .= $this->service . "</Service><ZipOrigination>" . $this->orig_zip . "</ZipOrigination>"; $str .= "<ZipDestination>" . $this->dest_zip . "</ZipDestination>"; $str .= "<Pounds>" . $this->pounds . "</Pounds><Ounces>" . $this->ounces . "</Ounces>"; $str .= "<Container>" . urlencode($this->container) . "</Container><Size>" . $this->size . "</Size>"; $str .= "<Machinable>" . $this->machinable . "</Machinable></Package></RateV2Request>"; } else { $str = $this->server. "?API=IntlRate&XML=<IntlRateRequest%20USERID=\""; $str .= $this->user . "\"%20PASSWORD=\"" . $this->pass . "\"><Package%20ID=\"0\">"; $str .= "<Pounds>" . $this->pounds . "</Pounds><Ounces>" . $this->ounces . "</Ounces>"; $str .= "<MailType>Package</MailType><Country>".urlencode($this->country)."</Country></Package></IntlRateRequest>"; } $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $str); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // grab URL and pass it to the browser $ats = curl_exec($ch); // close curl resource, and free up system resources curl_close($ch); $xmlParser = new xmlparser(); $array = $xmlParser->GetXMLTree($ats); //$xmlParser->printa($array); if(count($array['ERROR'])) { // If it is error $error = new error(); $error->number = $array['ERROR'][0]['NUMBER'][0]['VALUE']; $error->source = $array['ERROR'][0]['SOURCE'][0]['VALUE']; $error->description = $array['ERROR'][0]['DESCRIPTION'][0]['VALUE']; $error->helpcontext = $array['ERROR'][0]['HELPCONTEXT'][0]['VALUE']; $error->helpfile = $array['ERROR'][0]['HELPFILE'][0]['VALUE']; $this->error = $error; } else if(count($array['RATEV2RESPONSE'][0]['PACKAGE'][0]['ERROR'])) { $error = new error(); $error->number = $array['RATEV2RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['NUMBER'][0]['VALUE']; $error->source = $array['RATEV2RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['SOURCE'][0]['VALUE']; $error->description = $array['RATEV2RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['DESCRIPTION'][0]['VALUE']; $error->helpcontext = $array['RATEV2RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['HELPCONTEXT'][0]['VALUE']; $error->helpfile = $array['RATEV2RESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['HELPFILE'][0]['VALUE']; $this->error = $error; } else if(count($array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'])){ //if it is international shipping error $error = new error($array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR']); $error->number = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['NUMBER'][0]['VALUE']; $error->source = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['SOURCE'][0]['VALUE']; $error->description = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['DESCRIPTION'][0]['VALUE']; $error->helpcontext = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['HELPCONTEXT'][0]['VALUE']; $error->helpfile = $array['INTLRATERESPONSE'][0]['PACKAGE'][0]['ERROR'][0]['HELPFILE'][0]['VALUE']; $this->error = $error; } else if(count($array['RATEV2RESPONSE'])){ // if everything OK //print_r($array['RATEV2RESPONSE']); $this->zone = $array['RATEV2RESPONSE'][0]['PACKAGE'][0]['ZONE'][0]['VALUE']; foreach ($array['RATEV2RESPONSE'][0]['PACKAGE'][0]['POSTAGE'] as $value){ $price = new price(); $price->mailservice = $value['MAILSERVICE'][0]['VALUE']; $price->rate = $value['RATE'][0]['VALUE']; $this->list[] = $price; } } else if (count($array['INTLRATERESPONSE'][0]['PACKAGE'][0]['SERVICE'])) { // if it is international shipping and it is OK foreach($array['INTLRATERESPONSE'][0]['PACKAGE'][0]['SERVICE'] as $value) { $price = new intPrice(); $price->id = $value['ATTRIBUTES']['ID']; $price->pounds = $value['POUNDS'][0]['VALUE']; $price->ounces = $value['OUNCES'][0]['VALUE']; $price->mailtype = $value['MAILTYPE'][0]['VALUE']; $price->country = $value['COUNTRY'][0]['VALUE']; $price->rate = $value['POSTAGE'][0]['VALUE']; $price->svccommitments = $value['SVCCOMMITMENTS'][0]['VALUE']; $price->svcdescription = $value['SVCDESCRIPTION'][0]['VALUE']; $price->maxdimensions = $value['MAXDIMENSIONS'][0]['VALUE']; $price->maxweight = $value['MAXWEIGHT'][0]['VALUE']; $this->list[] = $price; } } return $this; } } class error { var $number; var $source; var $description; var $helpcontext; var $helpfile; } class price { var $mailservice; var $rate; } class intPrice { var $id; var $rate; } ?> This is how Im getting the info <?php require("usps.php"); $usps = new USPS; //http://production.shippingapis.com/ShippingAPI.dll //http://testing.shippingapis.com/ShippingAPITest.dll $usps->setServer("http://production.shippingapis.com/ShippingAPI.dll"); $usps->setUserName("****"); //Express, First Class, Priority, Parcel, Library, BPM, Media, or ALL $usps->setService("All"); $usps->setDestZip("21061"); $usps->setOrigZip("85284"); $usps->setWeight(4, 2); $usps->setContainer("Flat Rate Box"); $usps->setCountry("USA"); $usps->setMachinable("true"); $usps->setSize("Regular"); $price = $usps->getPrice(); print_r($price); ?> and that gives me this result USPS Object ( [server] => http://production.shippingapis.com/ShippingAPI.dll [user] => **** [pass] => **** [service] => All [dest_zip] => 21061 [orig_zip] => 85284 [pounds] => 4 [ounces] => 2 [container] => Flat Rate Box [size] => Regular [machinable] => true [country] => USA [zone] => 8 [list] => Array ( [0] => price Object ( [mailservice] => Express Mail Hold For Pickup [rate] => 49.70 ) [1] => price Object ( [mailservice] => Express Mail [rate] => 49.70 ) [2] => price Object ( [mailservice] => Express Mail Flat Rate Envelope Hold For Pickup [rate] => 18.30 ) [3] => price Object ( [mailservice] => Express Mail Flat Rate Envelope [rate] => 18.30 ) [4] => price Object ( [mailservice] => Priority Mail [rate] => 18.35 ) [5] => price Object ( [mailservice] => Priority Mail Flat Rate Envelope [rate] => 4.95 ) [6] => price Object ( [mailservice] => Priority Mail Small Flat Rate Box [rate] => 5.20 ) [7] => price Object ( [mailservice] => Priority Mail Medium Flat Rate Box [rate] => 10.95 ) [8] => price Object ( [mailservice] => Priority Mail Large Flat Rate Box [rate] => 14.95 ) [9] => price Object ( [mailservice] => Parcel Post [rate] => 12.29 ) [10] => price Object ( [mailservice] => Media Mail [rate] => 4.05 ) [11] => price Object ( [mailservice] => Library Mail [rate] => 3.85 ) ) ) I would like to be able to just pull out some of the mailservice and rate portions to use them later on in the form, like say a dropdown box but I do not know how to just isolate each item. For instance turn that result into a 3 item select box with these options Express Mail - $49.70 Priority Mail - $18.35 Parcel Post - $12.29 Hope that makes sense. Any help appreciated.
  22. Well it sort of makes sense but the problem is when I try to implement it it echos another drop box not a value So Im not too sure whats going on. Unless Im missing something that you meant. I read about the functions variables scope etc... so its making sense but not working. <?php //************************************** // Page load dropdown results // //************************************** function getTierOne() { $result = mysql_query("SELECT DISTINCT branch FROM rank") or die(mysql_error()); while($tier = mysql_fetch_array( $result )) { echo '<option value="'.$tier['branch'].'">'.$tier['branch'].'</option>'; } } //************************************** // First selection results // //************************************** if($_GET['func'] == "drop_1" && isset($_GET['func'])) { drop_1($_GET['drop_var']); } function drop_1($drop_var) { include_once('db.php'); $result = mysql_query("SELECT DISTINCT type FROM rank WHERE branch='$drop_var'") or die(mysql_error()); $branch=$drop_var; echo '<select name="drop_2" id="drop_2"> <option value=" " disabled="disabled" selected="selected">Choose one</option>'; while($drop_2 = mysql_fetch_array( $result )) { echo '<option value="'.$drop_2['type'].'">'.$drop_2['type'].'</option>'; } echo '</select>'; echo "<script type=\"text/javascript\"> $('#wait_2').hide(); $('#drop_2').change(function(){ $('#wait_2').show(); $('#result_2').hide(); $.get(\"func.php\", { func: \"drop_2\", drop_var: $('#drop_2').val() }, function(response){ $('#result_2').fadeOut(); setTimeout(\"finishAjax_tier_three('result_2', '\"+escape(response)+\"')\", 400); }); return false; }); </script>"; return $branch; } //************************************** // Second selection results // //************************************** if($_GET['func'] == "drop_2" && isset($_GET['func'])) { drop_2($_GET['drop_var']); } function drop_2($drop_var) { include_once('db.php'); $result = mysql_query("SELECT * FROM rank WHERE type='$drop_var'") or die(mysql_error()); echo drop_1($drop_var); echo '<select name="drop_3" id="drop_3"> <option value=" " disabled="disabled" selected="selected">Choose one</option>'; while($drop_3 = mysql_fetch_array( $result )) { echo '<option value="'.$drop_3['grade'].'">'.$drop_3['grade'].'</option>'; } echo '</select> '; echo '<input type="submit" name="submit" value="Submit" />'; } ?>
  23. Cant seem to figure this one out for a chained script. In the code below I need to take the value of $drop_var from function drop_1() and send it to function drop_2() So I can add it to the Where clause to limit the results of the third box a little more. But I cannot get the value to pass to the function. Any help appreciated. func.php <?php //************************************** // Page load dropdown results // //************************************** function getTierOne() { $result = mysql_query("SELECT DISTINCT branch FROM rank") or die(mysql_error()); while($tier = mysql_fetch_array( $result )) { echo '<option value="'.$tier['branch'].'">'.$tier['branch'].'</option>'; } } //************************************** // First selection results // //************************************** if($_GET['func'] == "drop_1" && isset($_GET['func'])) { drop_1($_GET['drop_var']); } function drop_1($drop_var) { include_once('db.php'); $result = mysql_query("SELECT DISTINCT type FROM rank WHERE branch='$drop_var'") or die(mysql_error()); echo '<select name="drop_2" id="drop_2"> <option value=" " disabled="disabled" selected="selected">Choose one</option>'; while($drop_2 = mysql_fetch_array( $result )) { echo '<option value="'.$drop_2['type'].'">'.$drop_2['type'].'</option>'; } echo '</select>'; echo "<script type=\"text/javascript\"> $('#wait_2').hide(); $('#drop_2').change(function(){ $('#wait_2').show(); $('#result_2').hide(); $.get(\"func.php\", { func: \"drop_2\", drop_var2: $('#drop_2').val() }, function(response){ $('#result_2').fadeOut(); setTimeout(\"finishAjax_tier_three('result_2', '\"+escape(response)+\"')\", 400); }); return false; }); </script>"; } //************************************** // Second selection results // //************************************** if($_GET['func'] == "drop_2" && isset($_GET['func'])) { drop_2($_GET['drop_var2']); } function drop_2($drop_var2) { echo "<br>($drop_var)<br>"; include_once('db.php'); $result = mysql_query("SELECT * FROM rank WHERE type='$drop_var2'") or die(mysql_error()); echo '<select name="drop_3" id="drop_3"> <option value=" " disabled="disabled" selected="selected">Choose one</option>'; while($drop_3 = mysql_fetch_array( $result )) { echo '<option value="'.$drop_3['grade'].'">'.$drop_3['grade'].'</option>'; } echo '</select>'; echo '<input type="submit" name="submit" value="Submit" />'; } ?> index.php <?php include('db.php'); include('func.php'); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Chained Select Boxes using PHP, MySQL and jQuery</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#wait_1').hide(); $('#drop_1').change(function(){ $('#wait_1').show(); $('#result_1').hide(); $.get("func.php", { func: "drop_1", drop_var: $('#drop_1').val() }, function(response){ $('#result_1').fadeOut(); setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); }); return false; }); }); function finishAjax(id, response) { $('#wait_1').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } function finishAjax_tier_three(id, response) { $('#wait_2').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } </script> </head> <body> <p> <form action="" method="post"> <select name="drop_1" id="drop_1"> <option value="" selected="selected" disabled="disabled">Select a Category</option> <?php getTierOne(); ?> </select> <span id="wait_1" style="display: none;"> <img alt="Please Wait" src="ajax-loader.gif"/> </span> <span id="result_1" style="display: none;"></span> <span id="wait_2" style="display: none;"> <img alt="Please Wait" src="ajax-loader.gif"/> </span> <span id="result_2" style="display: none;"></span> </form> </p> <p> <?php if(isset($_POST['submit'])){ $drop = $_POST['drop_1']; $drop_2 = $_POST['drop_2']; $drop_3 = $_POST['drop_3']; echo "You selected a "; echo $drop_3." ".$drop." ".$drop_2; } ?> </body> </html>
  24. Guess I could, figured there might be a better way to do it. The html tags were just to make it easier to make sure I was getting the results I wanted. Yes
  25. I have a function which is listing my directories w/ files (Images) in them. <?php function sortDirectory($path = 'images') { $ignore = array('.', '..', 'index.php'); $folder = array(); $dh = @opendir($path); while (false !== ( $file = readdir($dh) )) { if (!in_array($file, $ignore)) { if (is_dir("$path/$file")) { $folder[$file] = sortDirectory("$path/$file"); } else { $folder[$file] = "$path/$file"; } } } closedir($dh); ksort($folder); return $folder; } function getDirectory($folder = array(),$level = 0) { // Set which extensions should be approved in the XML file $extensions = array( 'jpg', 'JPG', 'png', 'PNG', 'gif', 'GIF', 'bmp', 'BMP'); $spaces = str_repeat(' ', ( $level * 4)); foreach($folder as $file=>$path) { if (is_array($path)) { echo "<strong>$spaces $file</strong><br />"; getDirectory($path, $level+1); } else { if ( in_array( substr($file, -3), $extensions ) ){ echo "$spaces <a href=\"$path\">$file</a><br />"; } } } } getDirectory(sortDirectory()); ?> Im trying to get it to write an xml file in this fashion <?xml version="1.0" encoding="utf-8" standalone="yes"?> <dir1> <pic> <image>file1.jpg</image> </pic> <pic> <image>file2.jpg</image> </pic> </dir1> <dir2> <pic> <image>file1.jpg</image> </pic> <pic> <image>file2.jpg</image> </pic> </dir2> but I cannot seem to get a grasp on this simplexml for more than 1 directory - any help appreciated.?
×
×
  • 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.