Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by phppup

  1. It seemed simple when I thought of it, but multiple variations are NOT producing the result I imagined.

    Essentially, I have a single table that I want centered on a webpage, with a second table to the right.

    </div> </center>
    <div style="float: right;">

    I enclosed the tables in <div> tags but my results did not improve.

    I do not want two side by side tables that are centered. I am trying to have one centered table with a second to its right.

  2. What would be the car, in this instance? jQuery?

    The car has obvious advantages. (although there are far less deaths from buggy incidents per capita, so is the trade off worth it?)

    Not trying to be a smarty, but if you are referring to jQuery, I don't find it as straight forward as JS, so unless I'm missing some great advantage, I think I have enough troubles already. LOL

    As always, your insight and guidance are appreciated.

  3. If my form is submitted, but fails during PHP validation, then I want info that was already submitted to be available.

    <input type="text" name="username" value="<?php if(isset($_POST['username'];} { echo $username; } ?> >

    This works fine and defines my goal.

    My troubles arose when I attempted a similar design with a drop-down menu.

    Making matters worse, that menu uses JavaScript.

    document.write("<select  name='menu'>");
    for(i = 1; i < 20; i++)  {
    document.write("<option value=' "+i+"'> " + i + "</options>");

    I've begun trying to add PHP into the <option> tag, but am not sure how (or if it's acceptable) to integrate the JS for the desired result.

    document.write("<option value=' "+i+"'
        <? if($_POST['menu'] == ?> +i+ <?        echo selected";?> 
                   > " + i + "</options>");

    I suppose I could swap the JS with PHP, but then I put unnecessary usage to the server.

    Best solution??

  4. OR perhaps I should take a different approach:

    I have a checkbox that controls a toggled effect on HTML background.

    var chosen = document.getElementById("XYZ4").checked;


    I'm considering adding a second checkbox that would have the same effect.

    Rather than hardcode both (and future) checkboxes, what would be the best way to retrieve an identifier so that it can be inserted as a variable and used to evaluate a condition?

  5. My very first entry on this topic was


    I've tried an exhaustive array of variations with single quotes, double quotes, and + sign combinations, but seem to be missing the bullseye.

    I believe my initial effort was


    That's what necessitated the post.

    But I can try it again, I suppose.

  6. I just KNEW you were going to do that. LOL.

    However, I'm not sure it's accurate (as if you need something to keep you busy) because if the 19 is on Sunday, the holiday would be Monday. [minus 2 changed to plus 1 ??]


    difference between a string value and a variable name

    Care to enlighten me?

  7. There's ALWAYS more code. But it's mostly HTML or unrelated.

    Essentially, I'm running through all the input tags and then separating those that are checkboxes.

    Then, I'm grabbing the ID of the checkboxes and using them [actually only one for now. ie:XYZ4] to "do stuff" depending on whether or not the box is checked.

    (I'd tell you what happens further down the line, but I haven't coded that far ahead yet. I was testing the waters as I progressed and stopped when I discovered this odd circumstance. However, my notion is to alter color or display a message if checked.)

    Again, it works when hardcoded and the number of checkboxes is minimal. But it would be nice to be able to have the code effective with each checkbox being evaluated through the 'for loop' (unless there's a better way to accomplish this).

  8. Signed into law yesterday to commemorate June 19, but recognized on the weekday closest to the 19th when 19 falls on the weekend.

    (This would be interesting to code. LOL)

    What kind of "observance" could there be if government workers weren't "entitled" to another day off from work (with pay)??

  9. Quote

    var inputs = document.getElementsByTagName('input');

    for(var x= 0; x< inputs.length; x++) {
        if(inputs[x].type  == 'checkbox') {


    //Create the variable
            var dee = inputs[x].id;


    var chosen = document.getElementById(dee).checked;

    //Do new stuff FAILS at this point UNLESS variable dee is hardcoded with an actual element ID.  

    [Ironically, there are only 2 checkboxes to be assessed, but I thought that this method of coding would "save time" (rather than hardcoded coding)... LOL

    Of course, it's always good tho learn (at least that's what THEY tell me.]



    should be using the Code <> button when posting code instead of the Quote " button

    I would if I could.

    But when I access from my very very smart phone, the quote is the only available option that resembles <>

  10. RE-POSTED for clarity and errors

    ** Ignore the TWO previous similar postings **


    It originates from in the beginning of a FOR loop and I then rename it to use within the same loop.

    At it's inception


    for ( yada yada yada.....) {

    alert (loop_item[x]); //displays XYZ4

    var dee = loop_item[x];

    alert(dee);              //displays XYZ4

    And I expected dee to work as described.


    What exactly is a "proper variable"? What would make it improper?


    Note: when posting code that contained [ ] and lowercase i 

    the code showed incorrectly and altered text to ITALIC.

    Mgmt may want to address this.

  11. My problem amounts to tryong to get element using a variable's value instead of a hardcoded name.

    This works


    var chosen = document.getElementById("XYZ4").checked;

    But this has been problematic


    //other code that produces

     result = XYZ4;

    var dee = result;

    var chosen = document.getElementById(dee).checked;

    I've tried an exhaustive array of variations with single quotes, double quotes, and + sign combinations, but seem to be missing the bullseye.

    How can I insert the variable so that var chosen is viable?





  12. I stayed surfing the web again (someone should unplug that thing) and went down the rabbit hole, again.


    //header("Content-Type: image/jpeg");
    //header("Content-Transfer-Encoding: binary");
    readfile("1a.jpg" , "r");

    The code above displays lines of character text.

    Uncommenting the two header lines created a black screen with a black outlined square.

    How can I get a the image to display?

    Can I use this method to display multiple images?

    Will this provide a layer of security by eliminating a visible url to the image?

  13. Either the code or it's creator needs to take a nap.

    I get cranky when I'm hungry.

    Empathetically, I accessed some code this afternoon that had worked fine 2 months ago. But this afternoon it was obstinate about running.

    It took 3 hours before I discovered that TWO conditional statements had been removed with comment tags.

    That darn code must've gotten active after I tucked it in and turned out the light.

    There's no other rational explanation.

    Pleasant dreams.

  14. You need to understand what your code is saying.

    The first version says: attempt this, attemp that, try to send mail, try going to the Thank You page.

    There are no indications or notifications of which success and which fail.

    The alternate version directs the process to EITHER go to the Thank You on success, or indicate failure.

    It's safe to safe the email is FAILING in all attempts.

    You just don't restrict it from going to the Thank You page on the first version.

    I would hardcode and see where that takes me. Also don't forget my initial statements about spam filters.

    I'm not familiar with PHPmailer, but it could be beneficial.

  15. @kicken  Using file_get_contents($image)

    gave me a page with characters and LOTS of black diamond-question marks.

    That's what got me into this mess, and lead me down a path that had suggestions on the WWW to use everything from decode_base64/encode_base64 to bin2hex etc.

    I think all my images are now inverted, upside-down, and  mixed between Latin, Arabic, and Japanese characters. LOL

    It seemed like a good idea at the start.

    Maybe I'll just back away from the path verrrry slowly.

  16. I would hardcode the troublesome header and see what happens.

    Maybe the code doesn't like something in 

    $headers = "From: $email_from" . "\r\n";


    PS: I did notice the command sending the user to the "Thank you" page. You could expand it and do something like


    if(mail(.... blah, blah...) {

    header('Location... blah blah

    } ELSE {

    echo "Message failed. Try again";


    Gotta go get a COVID shot. Good luck.

  17. If you put the first few words of a notification into a search engine, you can generally begin to find an understanding (and hopefully a solution).

    The last item of the message that provides "line #" is referencing the line in your CODE where the error occurred. (Taking into account that sometimes the error existed but didn't cause a problem until this point, the line number is accurate.)

    Depending on your code editor, the line numbers are available, although counting to line 21 isn't nearly as difficult as finding line 642. LOL. (an empty line is still a counted line)

    Make sure to eliminate the error initiation code BEFORE going live. It gives too much information to a user if displayed at an inopportune time.

    I'll take another look at your code, but beyond this point, there are other people here that would be more capable than myself.

  • 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.