Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Variables inside strings aren't interpretted when the string is wrapped in single-quotes. $a = 1;echo 'Number $a'; // Shows "Number $a"echo "Number $a"; // Shows "Number 1"
  2. You can read any file, the problem is how to interpret what is being read. Doc and docx file store all kinds of formatting data along with the text that's written, so you can't just read plain text from the file. Actually interpretting docx files on the server is really difficult, you would need a program with the complexity of Microsoft Word to read and manipulate docx data.
  3. I don't see where there could be a problem there, aside from <td> elements not being in a table. The apostrophes aren't interfering with anything in the HTML you're showing.
  4. How is the function being called? If it's through an attribute on the element then it won't work. The event handler has to be assigned through code: element.addEventListener("keypress", doOnKeyPress, false);// For IE 8 and underelement.attachEvent("onkeypress", doOnKeyPress)
  5. It will add 31 days to February 0th because today's the 31st of January, so the month changes to March.
  6. At the moment setMonth is called the date is set to today's date (31). Call setDate first and it will work. Look at this example to see for yourself: <!DOCTYPE html><html><head><title>Test</title><meta charset="UTF-8"><script>window.onload = init;function init(){var d = new Date();d.setFullYear(2014);d.setMonth(1);d.setDate(1);document.getElementById("demo").innerHTML= d;var d2 = new Date();d2.setFullYear(2014);d2.setDate(1);d2.setMonth(1);document.getElementById("demo2").innerHTML= d2;}</script></head><body><div id="demo"></div><div id="demo2"></div></body></html>
  7. SQL queries always return strings, Even number data types. PHP has to cast them itself. With numbers you usually don't have to worry about the casting, but with dates you have to parse the string. I think the strtotime() function will work fine. Personally, I store dates as a UNIX timestamp in an INT field in MySQL.
  8. Remember that the <form> element needs the enctype attribute to be set.
  9. Check the outputted source code to see what's being printed there.
  10. Yes, that's also a big problem. I hadn't looked carefully at the contents of imageFunc(). First of all, the function is getElementsByTagName. It returns a list, so you have to go through each element of the list. Since what you're trying to do is target the element that was clicked you're going to have to pass the element to the function: onclick="return imageFunc(this);" Inside the function, refer to the element in the function's argument: function imageFunc(a){ window.open(a.href, "_blank", 'left=20,top=20,width=500,height=500,toolbar=0,resizable=1, scrollbars=yes'); return false;}
  11. If this is affecting the HTML, check the source code to see what's showing up on your page. Also, show the line of PHP code associated to this problem. I doubt SQL is related to this.
  12. Then the htaccess file is fine. Your PHP has syntax errors. The code you psoted here looks fine but the one you're testing probably doesn't have include/code.php wrapped in quotation marks.
  13. This line is probably the cause of the problem: AddType text/html .php
  14. The <table> element doesn't have an onload attribute. Only <body> and <img> have it. The main problem is that, since you're using an attribute for the event, return false has to be in the attribute itself. onclick="imageFunc(); return false" Or onclick="return imageFunc();"
  15. Here's a list of other unicode characters that some programs input rather than an apostrophe: http://en.wikipedia.org/wiki/Quotation_mark_glyphs Alternate single-quotes: ’ ‘ ‛ ' Alternate double-quotes: “ ” ‟ " If you're receiving documents with any of those characters there's a chance that some browsers with certain fonts and encodings won't render them. Go through the text you're receiving from people and make sure the apostrophes and quotation marks are actually ' (ASCII 39) and " (ASCII 34) before putting them on your web page.
  16. You'll need to learn HTML and CSS for this, it's not something we can show in 5 lines of code. Have you tried anything yet?
  17. Here's the page concerning copyright of the W3Schools website: http://w3schools.com/about/about_copyright.asp It's unlikely that they will grant you permission to copy their site, but you could request written permission by sending them an e-mail to
  18. The only characters that require entities are < and &. The rest are optional and depend on the situation. Are you sure you're typing an apostrophe? I know that some people with european keyboards sometimes accidentally use ´ rather than ' for an apostrophe. Your editor might be substituting the apostrophe for one of those embellished single-quotes as well.
  19. This is elementary school math, a linear one-variable equation. 0.016 × x = 0.2 therefore x = 0.2÷0.016 Substitute it with the input variables perCost × x = minPurchase therefore x = minPurchase ÷ perCost The minimum amount needed to reach the price is ceil($minPurchase/$perCost). I use ceil() because if the result of the division is 1.2 you actually want 2 rather than 1.
  20. You haven't explained the problem well enough for me to understand. Is $minPurchase set beforehand or do we have to figure it out? If you want to know how many $perCost for a $minPurchase, just do a division: $minPurchase/$perCost.
  21. You're redeclaring the value of html on every iteration of the loop. What you want to do is add new data to it. Look how it works in my example. I advise against ever using the var keyword in a loop. I'm not entirely familiar with jQuery, but because it's a class selector, $('.drop') probably returns a list of items, so I'm not sure if the .html() method would work. You might need to target a single element. If you give the element an ID rather than a class name then that won't be a problem.
  22. I created it in Javascript since that's what you're working with now. Converting the code to PHP wouldn't be very difficult. It's just a short code showing how to put data into a dropdown list.
  23. Better to do it with PHP. Create a <select> element and one <option> element for each timeslot. var html = "<select name='time'>";for(var i=0; i < timeslots.length; i++) { html += "<option value='" + timeslots[i] + ">" + timeslots[i] + "</option>";}html += "</select>";element.innerHTML = html;
  24. I'm not seeing the error you mentioned. What type of bracket < > ( ) [ ] { } is causing the problem and what does the error message say?
×
×
  • Create New...