Jump to content

Barand

Moderators
  • Posts

    24,602
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. Yes. You would use the on change event to send an AJAX request to the server and return a value to let you know if is taken or not.
  2. Avoid problems with spaces and lowercase entirely by restructuring your array $cakesmade = array( "kate" => array( 0=>array( "cakename" => "cake", "cakeingredients" => "egg, flour" ), 1=>array( "cakename" => "Lovely Chocolate Cake", "cakeingredients" => "chocolate, eggs, flour" ), 2=>array( "cakename" => "amazing cake", "cakeingredients" => "lemons, flour" ) ) );
  3. ... WHERE DATE(departure_date_time) = CURDATE()
  4. You said you wanted the chart on the same page
  5. No problem now we have established that works <?php $dir = './data/test111'; $ddArray1 = scandir($dir,1); ?> <html> <head> <title>Select Drop Down List</title> </head> <body> <form action="" method="get"> <select name="file"> <?php FOREACH($ddArray1 AS $file){ PRINT '<option value="'.$file.'">'.$file.'</option>'; } ?> </select> <input type="submit"/> </form> </body> </html> <?php if (isset($_GET['file'])) { $id = $_GET['file']; echo "<img src='mygraph.php?file=$id' />" ; } ?>
  6. Don't output a checkbox for times already booked. If you look at the booking form in the code I gave you you will see it only allows input for non-booked times (except for a cancellation checkbox). And add a unique key on (date, starttime) in the booking table to prevent duplicates. Add a hidden input field to your form containing the date value <input type="hidden" name="date" value="2015-01-22" /> then you can access with $_POST['date'] Why are you hard-coding all those start times in your form instead of pulling them from a timeslot table in the db? Again, if you look at my code you will see it uses a query with FROM timeslot LEFT JOIN booking so you know all the timeslots and which timeslots have/not been booked for the day
  7. No guarantees, but try putting the php portion of your code in a separate file (mygraph.php) and use GET instead of post. In a separate php file put $id = whatever; echo "<img src='mygraph.php?file=$id' />";
  8. Your join() isn't putting the statuses in quotes. It will give IN (active,inactive,un-verified,cheater)
  9. By using the "text-align" attribute in the cells style definition. https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
  10. You can format it in your query EG SELECT DATE_FORMAT(datecol, '%d.%m.%Y') as formatted_date or you can do it in php echo date('d.m.Y', strtotime($row['datecol']));
  11. I set up styles with 3 background colours pale green - default, no bookings yellow - partially booked days red - fully booked days td { background-color: #C4E5C4; } td.full { background-color: red; color: white; font-weight: 600; } td.partial { background-color: yellow; color: black; font-weight: 600; } This the relevant code to apply those classes if (isset($bookings[$d->format('Y-m-d')])) { // are there bookings in db for that day? $tit[$dow] = wordwrap($bookings[$d->format('Y-m-d')][1],34); // construct popup of free times (on hover) if ($bookings[$d->format('Y-m-d')][1]) // are there free slots? $clsArray[$dow] = "class='day partial $now'"; // if so, apply "partial" class else $clsArray[$dow] = "class='day full $now'"; // if not, apply "full" class }
  12. Do you want me to answer that here or in that (yet another) thread you have now raised?
  13. The code I gave you in your original thread on this topic (you now have 3 of them) showed you how to colour code your cells and almost all the other things you said you wanted (like showing available times on hovering, making the cells clickable, displaying a booking form for the clicked day). Look at the code, the answers are there.
  14. Nonsense!. You can access any bits of a datetime field that you need. EG mysql> SELECT dob FROM date_sample; +---------------------+ | dob | +---------------------+ | 2014-09-11 20:57:22 | +---------------------+ mysql> SELECT YEAR(dob) as year FROM date_sample; +------+ | year | +------+ | 2014 | +------+ mysql> SELECT MONTH(dob) as month FROM date_sample; +-------+ | month | +-------+ | 9 | +-------+ mysql> SELECT DAY(dob) as day FROM date_sample; +------+ | day | +------+ | 11 | +------+ mysql> SELECT DATE_FORMAT(dob, '%b %d') as birthday FROM date_sample; +----------+ | birthday | +----------+ | Sep 11 | +----------+
  15. As a space-saver it isn't much of an idea either A DATETIME field in a table occupies 8 bytes whereas $serialized_date = 'a:3:{i:0;s:2:"03";i:1;s:2:"02";i:2;s:4:"1986";}'; echo strlen($serialized_date); #---> 47 39 wasted bytes!
  16. You'll have to unserialize() then join() to get a string value. Why are a you using a relational database to store data in a manner that prevents you from ever using it as a relation database? I recommend you read up data normalization and relational database design.
  17. Output an HTML anchor tag with a link to the file. echo "<a href='path/to/file'>View</a>";
  18. You are connecting with mysql_connect() then using mysqli_query(). You need a mysqli connection, you cannot mix the two.
  19. Check your array is as it should be echo '<pre>',print_r($opts, true),'</pre>'; For example, is there a "/" missing from the URL item?
  20. echo urldecode("Galaxy+Universe+Admin"); #--> Galaxy Universe Admin
  21. The array code is perfectly valid. If you want an indexed array to start at 1 instead of 0 $array = array( 1 => "a", "b", "c", "d", ); echo '<pre>',print_r($array, true),'</pre>'; RESULT Array ( [1] => a [2] => b [3] => c [4] => d ) See PHP manual http://php.net/manual/en/language.types.array.php example #5
  22. Replacing the current <script> with this in the code I posted in your other thread will do it <script type="text/javascript"> //******************************************** // Create the on-click function for each // clickable cell (class = day) // to resubmit the page with clicked date //******************************************** <?php if (isset($_GET['date'])) { echo "var formvis = \"visible\";" ; } else { echo "var formvis = \"hidden\";" ; } ?> $().ready(function(){ $(".form").css("visibility",formvis); $(".day").click(function(){ location.href="?date="+$(this).attr("id"); }) }) </script>
  23. does this help? http://www.firstdata.com/downloads/marketing-merchant/fdgg-web-service-api-v3.pdf
  24. Then what are you sending to Linkpoint, if it requires an xml string?
  25. If I understand right, the second block above should be like the third, not using POSTs that don't exist.
×
×
  • 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.