Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by CroNiX

  1. Notice how the original (crap code) is <FORM METHOD=\"post\" ACTION=\"$PHP_SELF\"> So you'd need <FORM METHOD=\"post\" ACTION=\"\">
  2. You probably didn't escape the quotes, since the entire form is contained in a php variable as a string (which is stupid).
  3. leave the action blank, action="" and the form will submit to the current url. Or use something like <?php echo htmlentities($_SERVER['PHP_SELF']); ?>
  4. Isn't what you are calling internal the same as private? Try calling a private method from outside the class.
  5. That really depends on the format/structure of the data. if it was something like: $data = 'one|two|three'; it would be as simple as: $data_array = explode('|', $data);
  6. http://php.net/manual/en/book.geoip.php
  7. Did you happen to search for "php imap save attachment"? If it is truly an email attachment there are imap methods to retrieve it/them and then display or save them however you want.
  8. For creating/editing db tables/data, you can use phpmyadmin
  9. It probably has to do with where you set $_SESSION['posttimer']. Hard to follow with all of the misaligned braces.
  10. You can protect from downloading the raw mp3 as a file, but you can't protect against the user recording what is playing through their soundcard as a new mp3/wav/flac/whatever.
  11. Does mixing mysql and mysqli functions actually work? (mysql_query(), mysqli_query())
  12. The problem you were having here: $get_available_towns[] = $town; $get_available_towns = array(); Is that you add $town to the $get_available_towns array, which is fine, but then you reset the $get_available_towns array to be empty immediately after that so it will never contain anything.
  13. It adds a new element to the end of $get_available_towns array. $towns = array('New York', 'Portland', 'Boston'); //Add Chicago to the $towns array $towns[] = 'Chicago'; $towns now equals array( 0 => 'New York', 1 => 'Portland', 2 => 'Boston', 3 => 'Chicago' )
  14. Maybe instead of using jQuery's fade(), which cycles through hundreds of transparency levels, make your own "effect" and only use 3 colors of gray going from dark to white. So instead of hundreds of transitions/character or word, it is only cycling through 3 or so. If it's transitioning from word to word fast enough, the illusion would be kind of the same but spare a lot of processing overhead. On my way out the door, but if I think of it later I can play around with it and see if I can come up with something efficient and useful.
  15. I know it would look cool, but that will take a lot of processing to do that and most likely it wouldn't be smooth and would end up being jerky, especially on mobile/slower devices. I've done it for single letters in a word, but not each letter of an entire paragraph, or even worse multiple paragraphs. It would probably be better doing words instead of letters.
  16. Because it's an array within an array, so you need to access the first element (0), which gives you the array with your actual values.
  17. Well, that's not valid HTML for your <select> dropdown. each one needs to be it's own option, not separated by <br>. Each option needs to look like: <option value="what gets sent with the form">Text to display in dropdown</option> So change this: while($row = mysqli_fetch_array($result)) { echo $row['tankname']; echo "<br>"; } to while($row = mysqli_fetch_array($result)) { echo '<option value="' . $row['tankname'] . '">' . $row['tankname'] . '</option>'; } and then remove the <option> </option> from the <select> in the HTML so it's just: <select id="tankname" type='text' name="tankname"> <?php include_once '/include/dropdowns/water-parameters-dd.inc.php'; ?> </select>
  18. It isn't. Try it. DOM ready means the DOM (structure) is loaded into the browser, not when all javascript is executed. It works if you put the $("tr:odd").addClass("odd"); as the last line of the getJSON callback function where he is creating the table.
  19. right, but when the dom is ready his ajax call hasn't fired yet.
  20. Because you first apply the 'odd' class to nothing upon domready (the table isn't created yet), and then retrieve the json and populate the table. Apply the odd class after you retrieve the json/create the table. also you can write this javascript: document.getElementById("PresidentInfo").innerHTML=output; with jQuery: $('#PresidentInfo').html(output);
  21. CroNiX

    case help

    Sorry, I've never attempted that. I haven't been able to find an example of a conditional JOIN and from what I read it wasn't possible. Just about all the answers said to use a IF/CASE in the select and a OUTER JOIN on the table.
  22. why do you create so many extra variables that you never reuse? And create variables and then just store them in another variable? $date = date('dmy'); $prefix="Temp-"; $suffix=$date; $filename=$prefix.$suffix.".csv"; // Solution $filename = 'Temp-' . date('dmy') . '.csv';
  23. Also won't work if user has javascript disabled. If you want foolproof, wrap the image in an anchor, which has a native click event. div's don't.
  24. That is MUCH cleaner and very good for the PHP/HTML separation. You really shouldn't use PHP to output HTML like you originally were unless there is no other way. Doing that means PHP actually has to parse it, which takes a bit of extra processing, which takes additional time to do. Also, editors won't be able to typehint/colorize HTML if it's wrapped in PHP tags, as it's considered a PHP string at that point and not an HTML tag. I just question the < you have in the image tag right before the height="300" You will also probably want to use a HTML5 doctype and NOT XHTML. Otherwise some code will be invalid as you have written it as you don't close certain tags, like <img />. In XHTML, every HTML tag needs to be terminated.
×
×
  • 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.