Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. If you've got some time, you could use Docker or install WSL. Otherwise, you'll have to set up another version of your production server and blow things up there instead of the live site.
  3. // $id may or may not exist, doesn't matter for ($i = 0; $i <= 5; $i++) { if (isset($_REQUEST["element_id_$i"])) { // Now you're checking _any_ input for anything called element_id_{0-5} and assigning it to the session variable. // $id is still potentially undefined $_SESSION["element_id_$i"] = $_REQUEST["element_id_$i"]; // OK, so now $id is a string or integer or float or whatever (validate your input, please) $id = $_SESSION["element_id_$i"]; // $_SESSION['element_id'] is an array because you're using array_push array_push($_SESSION["element_id"], $id); } // And now $id is an array because you're overwriting the value you've already put in there // Also, at this point if $_REQUEST['element_id_{0-5}'] _isn't_ set, $_SESSION['element_id'] should // not exist and you'll get an error $id = $_SESSION["element_id"]; } So $id is an array. You can use variables as array keys, but the value of those variables has to be a string or integer - you can't use an array as an index in another array.
  4. Thanks. That's what I was afraid of. They'll switch my website and then I'll have to fight with a non-working live version trying to fix it. Any idea how to set up a test environment? The problem is that I'm on Windows and the web hosting company uses Linux (or FreeBSD) if I'm not mistaken.
  5. Evening Requinix, Thanks for the reply. Just coming back to let you know I've wrote something which works well. The markup for the Modal is: <div id="animatedModal" class="popup-modal"> <!--THIS IS IMPORTANT! to close the modal, the class name has to match the name given on the ID --> <div id="btn-close-modal" class="close-animatedModal close-popup-modal"> <i class="ion-close-round"></i> </div> <div class="clearfix"></div> <div class="modal-content"> <div class="container"> <div class="portfolio-padding"> <div class="col-md-8 col-md-offset-2"> </div> </div> </div> </div> </div> I've created 1 array to hold the different sets of Data: var projects = []; projects[0] = []; projects[0][0] = "Simple Glitter Application <br> By Creative Services"; projects[0][1] = "A quick and simple demonstration to show how to apply a fine glitter, this should only be completed at the designated glitter station, remember to tidy up afterwards. If you require glue pens ask the Mocking-up Team in creative support"; projects[0][2] = "mov/SimpleGlitter.mp4"; projects[0][3] = "Supplies:-<br>Glue pen, chosen glitter, a brush and a sheet of A3 paper not card."; projects[1] = []; projects[1][0] = "Heading 2"; projects[1][1] = "Description 2"; projects[1][2] = "mov/FoilHotStamper.mp4"; projects[1][3] = "Supplies 2"; projects[2] = []; projects[2][0] = "Heading 3"; projects[2][1] = "Description 3"; projects[2][2] = "mov/video3.mp4"; projects[2][3] = "Supplies 3"; And this is the jQuery I've done to add the data: $('#btn-close-modal').click(function(){ var vid = document.getElementById("video-element"); vid.pause(); vid.currentTime = 0; $('.modal-content .container .portfolio-padding .col-md-8.col-md-offset-2').empty(); }); $('.portfolio_item').click(function(){ var id = $(this).attr('id'); id = id.match(/\d+/); var theData = ""; theData = "<h2>" + projects[id][0] + "</h2>"; theData += "<p id='description'>"+ projects[id][1] + "</p>"; theData += "<video controls width='640' width='480' data-type='video' data-offsetY='2400' data-speed='1.5' id='video-element'>"; theData += "<source src='" + projects[id][2] + "' type='video/mp4' />"; theData += "</video>"; theData += "<p id='additional-info'>" + projects[id][3] + "</p>"; $('.modal-content .container .portfolio-padding .col-md-8.col-md-offset-2').append(theData); }); Thank you for responding. Am I able to mark this as 'completed' or 'answered' my end? Cheers, BSD
  6. Yesterday
  7. $id is defined like this: for($i=0; $i<=5; $i++){ if (isset($_REQUEST["element_id_$i"]) ) { $_SESSION["element_id_$i"] = $_REQUEST["element_id_$i"]; $id = $_SESSION["element_id_$i"]; array_push($_SESSION["element_id"],$id); } $id = $_SESSION["element_id"]; } and $quantity is similar.
  8. $cart_items[$id] = $quantity; and $cart_items = array($id => $quantity); are two very different things. What's the value of $id?
  9. When I use this: $cart_items[$id] = $quantity; or this: $cart_items = array($id => $quantity); I get the error: Illegal offset type
  10. The text file is probably not the right way to go with this. I'm looking for actual markup right now. What is it for the images, and for the modal?
  11. OK, so if instead of 1 action you have three separate scripts specified as actions for the form - but you still have to write the code to do those actions. Each of those three would have to do step 1 (get the data) thus tripling that code. If one step fails, do you still want too do the others? How do you control that if they are now separated? What would you gain?
  12. They're quite a bit different, but not as drastically different as some past versions were. This is a great time to set up a local environment for yourself to develop and test with. It would make doing this upgrade much easier for you.
  13. Hi everyone: I have a custom website that was written using PHP 5. It is currently hosted on DreamHost under PHP v.5.6. Since about last month they started pushing me to convert to PHP 7.X. So today they sent me an email that they will automatically convert it to PHP 7.2 on Nov. 18. Thus my question. How different are those versions? I wasn't using any fancy classes or anything like that. There's probably only a library for integration with PayPal and one for SendinBlue. But they are not mine. PS. Also do you know if there's a way to test it such conversion from 5.6 to v.7.2. I don't want to perform all work on a live website.
  14. Thanks. You know, I'd also like to share a sentiment about the big picture. Not being able to find good simple PHP script examples for this is one thing, but what's far worse is that after all these years and still in the year 2019 it is APPALLING that there hasn't been an improvement, change, upgrade, whatever you want to call it, by whoever does such things for HTML, so that one still can't simply just add multiple actions to HTML forms to run after a single submit and not even need lots of new convoluted other script code. I think I found evidence of people asking how to do multiple actions from one submit at least as old as the year 2000, and there's probably more online from before that.
  15. Hi Requinix, Thank you for the reply. The images are just added to the HTML like normal, but it's the modal data that needs to be dynamic. I've attached a picture of the layout of my images and also the modal which opens upon click. I'm going to add all the different images via the HTML, but for the modals, I don't want to have lots of them - in case I need to add lots more. The second image attached is the modal data, this needs to be dynamic. Is there a way that when I click the box next to the Unicorn one, I can have the same modal open but with the relevant data? Maybe upon click, read a .txt file, find the line relating to that set of data and show that in the modal? Is that the best way to do it, or maybe save the data in a JavaScript array and upon click, find the array ID and do it that way? What's the best way please? Many thanks in advance, BSD
  16. Places to look for each of the above steps,,, https://www.php.net/manual/en/reserved.variables.get.php https://www.php.net/manual/en/function.mail.php https://phpdelusions.net/pdo https://www.php.net/manual/en/function.http-build-query.php
  17. Thanks for the outline, that does help a bit. I don't actually do PHP and have only dabbled in it a few times. I know it's good stuff. However, I did do something else in IT for about 15 years. I have lots of experience finding solutions online and have a very good sense of what one should expect to be able to find online. That said, I think it's both odd and even pretty ridiculous that there are not simply many examples of ready made scripts for these simple needs to be easily found in many places online, so it's not quite the way you characterize it.
  18. Okay. Then see the link in my first reply.
  19. now I understand, it was my mistake It must delete everything HTML inside the div that includes class comments-box (not just div) http://prntscr.com/pvinrw
  20. https://3v4l.org/040Pe YOUR CODE WORKS FINE. WHAT IS THE PROBLEM?
  21. I need something like this with Dom preg_replace('#<div class="(.*?)comments-box(.*?)">(.*?)</div>#', '', $html); Must delete all div, which contains class combinations that contains word comments-box. They can be billions. I can't do it manually
  22. HI All, I am writing a prepared statement to update some user information. Included in this table are the username and password fields. In this particular form, i dont want the user to have access to this information and have built a form that only shows what i want them to be able to change. The bit that i am not sure about is the prepared statement that i am writing. I am getting a boolean error suggesting that my prepare failed and i think this may be because i have not named every field in the table. To give an idea of the table fields i have pulled this from php my_admin (this is not the sql i am running) UPDATE `ssm_user` SET `user_id`=[value-1],`user_email`=[value-2],`user_password`=[value-3], `user_firstname`=[value-4],`user_lastname`=[value-5],`user_accountlevel`=[value-6], `user_mobile`=[value-7],`user_role`=[value-8],`user_lastlogondate`=[value-9] WHERE 1 my prepared statement is $stmt = $conn->prepare(" UPDATE ssm_user SET user_email=?, user_firstname=?, user_lastname=?, user_accountlevel=?, user_mobile=?, WHERE user_id = ? "); $stmt->bind_param('sssssi', $email, $fname, $lname, $accountlevel, $mobile, $uid); $stmt->execute(); return $stmt->affected_rows; Do i have to declare every field in the table or is there something that i am missing here.
  23. You want to do something. Your code already does it. What is the problem?
  24. Your HTML <table> is messed up. Your missing </tr> tags and using a table in a table is not the way to go when what you want can be done using css tooltips. If you run your code for a simple query and post the html resulting and explain it, I or someone else could give you the needed table code. Also tell us where the cursor is to get the output.
  25. This time, your answer doesn't help me with anything, sorry I need that if a div contains a class that includes word "comments-box". example: "23comments-box234"; "sdgcomments-boxsdg" and feels others, is eliminated with DOM code that I wrote above Sorry and Thanks for your time lost with me
  26. You could take the code in your first post, make it a function and use the " wash, rinse, repeat" approach.
  1. Load more activity
  • Member Statistics

    • Total Members
      185,640
    • Most Online
      1,581

    Newest Member
    zeus69
    Joined
  • Forum Statistics

    • Total Topics
      300,860
    • Total Posts
      1,557,524
×
×
  • 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.