Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Be default, the display property for <div> tags is set to "block". This means that a line break is added before and after the <div> tag. Since it looks like you are trying to display a series of images with a text block below the photo, you could wrap both the image and the <div> tag with a parent <div> tag. Then using CSS to, you could float that parent div tag to the left. For code examples, you could run a Google search for "css image gallery with captions".
  2. It sounds like something went wrong with the database query that resulted in $tweets / $tweet. Have you tried enabling the error reporter for PDO? More information can be found here: https://www.php.net/manual/en/pdo.error-handling.php
  3. Thanks! I highly doubt I'll use the technique. Text changes too much for me to feel comfortable using this to create links on a website. However, maybe the technique would be useful for pointing out something on a website to a colleague / stakeholder.
  4. I just noticed that the W3C website uses links like the following: https://www.w3.org/TR/UNDERSTANDING-WCAG20/seizure-does-not-violate.html#:~:text="Flashing" refers to content that,users could turn it off. The technique doesn't appear to work with Firefox, but seems fine with both Chrome and Edge. Does anyone know what this technique is called?
  5. PHP is getting confused about the single quotes in the SESSION variable. You could add curly brackets around the variable: $query = "SELECT page_url,link_anchor_text,page_description,keyphrases,keywords FROM links WHERE {$_SESSION['search_column']} = ?"; Or you could utilize string concatenation: $query = "SELECT page_url,link_anchor_text,page_description,keyphrases,keywords FROM links WHERE " . $_SESSION['search_column'] . " = ?"; Note that you want to validate the "search_column" variable. That way you prevent the query from potentially breaking if the column name is a reserved word or if the column name doesn't exist in the database table. You will also want to prevent things like SQL injection attacks.
  6. Yes If the drop down was malfunctioning, there was something else wrong with the code. Perhaps one of the tags was missing or coded incorrectly. All the above "Select here" code does is create a new option in the drop down so that neither "Yes" or "No" is the default selection, which is a good way to make sure the user actually makes a selection. They have to actually to interact with the drop down to answer the question. That depends on the tutorial. Most tutorials don't talk about everything a reader needs to know in order to do something. Otherwise too much time will be spent on trying to explain the basics before they can get to the topic the tutorial was designed for. Or maybe this was beyond the scope of the tutorial. If the tutorial was about creating a simple form, for example, they are not going to go into ever facet of an HTML form. There would be too many things to discuss for a single tutorial.
  7. I haven't run into a situation where I've needed a submit button with both text and an image. But here's what Kicken mentioned earlier: Alternatively, you could make the text part of the image and use <input type="image">, which also submits the form. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/image
  8. You only need to use the "for" attribute if there is something between the form input and the corresponding form label. I avoid using "for" whenever possible because it's cleaner / less code. However, there are cases where I needed to use the "for" attribute. More information about the <label> tag, along with the benefits of using the tag, can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label FYI - the following code is acceptable: <input type="radio" id="male" name="gender" value="male"> <label for="male">Male</label> However, I would actually change it to the following: <label><input type="radio" name="gender" value="male"> Male</label> As Barand mentioned, <label> tags are designed to associate a input field (e.g. input tag, textarea, etc.) with it's corresponding field label. So, in the example provided, the "Male" label needs to be connected with the corresponding radio button. The same goes for the "Female" label. Note: if the <label> tags are set up properly, clicking the label should put focus on the corresponding input field. In the case of radio buttons, clicking the label will select the radio button associated with the clicked label.
  9. The while loop in the above code is missing a closing curly brace.
  10. Are you getting any errors? Is PHP set to output all errors? Perhaps the call to header() isn't being executed. Have you tried outputting something right before the call to header()?
  11. More information about redirecting with PHP can be found here: https://www.php.net/manual/en/function.header.php
  12. The following line looks like JSON. {"code":0, "reason":"OK", "resp":"AT+CCFC=1,3,\" 92061460\"\r\nERROR\r\n"} You could try using PHP's json_decode() function to extract the code, reason, and resp variables. More information, including examples, can be found in the manual. https://www.php.net/manual/en/function.json-decode.php Then you could use explode() to break the "resp" component based off the double quote ("). Then chop off the third value, assuming the lines always look similar to the above. Does the following line come from the API? {"code": 0, "reason": "OK", "resp": "AT + CCFC = 1,3, \" 92061460 \ "\ r \ nOK \ r \ n"} Unless I'm missing something, that's not valid code. Basically, the "resp" portion is equal to "AT + CCFC = 1,3, \" 92061460 \ "\ r \ nOK \ r \ n", which is surrounded by double quotes. In order to use double quotes in the middle of the string, they need to be escaped with a backslash. The first escaped quote is fine. The second one is not since there is a space between the backslash and the quote. The \r and \n entities are also invalid because of the extra spaces.
  13. Also, please use code tags when posting code to the forum. It makes the post much easier to read. One way to add code tags is to click the <> icon in the toolbar above the area where you are writing the post. It's right next to the smiley face.
  14. Is validDate() defined in your script? Note that PHP has a built-in date checker. More information can be found here: https://www.php.net/manual/en/function.checkdate.php If you scroll down to the "User Contributed Notes" section, there is a user-defined function validateDate() that you could experiment with.
  15. Welcome back to PHP and welcome to the forum!
  16. What type of website are you building? Is it a blog or some kind of resource library? In other words, would the contents of all these pages be better suited for a database? Perhaps there's a way to build a single page in PHP which pulls the necessary information from the database based on a passed ID.
  17. Since it looks like you are using jQuery already, you could use one of their selectors. For example, you could look for <div> tags that contain an "id" attribute where the value ends with "-order-no". More information about writing the selector, including an example, can be found here: https://api.jquery.com/attribute-ends-with-selector/
  18. Are you using MySQL? If so, have you tried the built-in date functions to get the needed information? More information about the functions can be found here: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html
  19. Hmm... When I do that in both Firefox and Chrome, there's only an option to download the website files. You see an option to create a website shortcut? In case anyone is looking for a quicker way to create a shortcut, you can also grab the lock icon (or where the lock would be for non-secure website) near the URL in the browser's address bar and drag it to your desktop.
  20. Is this what you are looking for? https://www.lifewire.com/create-shortcuts-in-google-chrome-for-windows-4103617
  21. Are asking about the Google Chrome browser? In other words, if you click one icon, the browser displays specific options. If you click the other icon, the browser displays different options? If so, you could set up different Chrome profiles and create a shortcut for each. https://www.howtogeek.com/256629/how-to-create-a-windows-shortcut-to-open-a-specific-profile-in-chrome/ Or are we talking about loading a web page differently based on those Chrome shortcuts? I'm a little confused since the question was posted in the HTML forum.
  22. Just to clarify, do you want the name for team 1 to be 25 characters? And the name for team 2 to be 25 characters? So you would have 50 characters at most for both team names? If so, you could try requinix's suggestion above. You already exploded the names. From there, you can use substr() to limit each name.
  23. Placeholders, by themselves, will make the form less accessible for people with certain disabilities. More information can be found here: https://webaim.org/techniques/forms/advanced Be aware that the <label> tag isn't doing anything here: <form action="/quickfind" id="quickfind" method="post" name="quickfind"> <label>Enter your name</label><br> <input type="text" id="find-search" placeholder="First name"><br> <input type="text" id="find-search" placeholder="Last Name"> </form> It needs to be connected to an <input> tag using the "for" attribute...or the label and corresponding <input> tag need to be enclosed with open/close <label> tags. Also, I'm fairly certain a <label> tag cannot be connected with two separate input fields. Each of the <input> tags above need their own label. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label FYI - There is an easy way to tell if a label is connected with an input field. Clicking the label in your browser should place focus on the corresponding input field.
×
×
  • 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.