Jump to content

acidking

New Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by acidking

  1. Where did I ask for their 'opinion'? Are you hallucinating? or perhaps you're in the wrong post? In the post we're in now I asked how to specifically implode values of checkboxes. Yes I used google, I didn't particularly find how to implode values of checkboxes.

     

    Eventually my final code turned out to look slightly different:

     

    if (isset($_POST['box'])) {
    $checkbox = mysql_real_escape_string(implode(", ", $_POST['box']));
    }
    

     

    This is proof to you that I am learning and all I needed was pointers, so you can go and *#$% yourself you're full of *&*%#.

     

    My first post was polite, it didn't work, my second post was polite, nothing came out of it, seems there's a method for getting around on here.

  2. This forum is not for giving you answers, it is to help you to find your errors on your own so you may learn to debug your own code in the future. If you want straight forward answers, there is a freelancer section.

    I don't need a freelancer, I am trying to learn, the books don't exactly cover each possibility you can do with php.

     

    Dude, take the language down a notch. If you don't like the answers you get, leave. Don't be a whiny child.

    How about; if you don't have the answers, f*** off.

    Look, it is literally this simple

    $query="INSERT INTO boxesTable (boxes) VALUES ('" . implode("','", $_POST['box']) . "')";

     

    No foreach needed.

    Thank you kindly! Though I am not sure I'll be asking question here again because clearly no one has the answers, and the community proved unreliable and unsupportive.

     

    I am not working on a serious project, I have a small project I am experimenting with in order to learn, so it doesn't matter whether it's the ideal way or not, I just need to know how such things are done, but why do I have to explain this on length? Makes no sense.

  3. Hi all, this my first post.

    I'd like to insert values of checkboxes as a string using a comma as a delimiter.

     

    So I have these checkboxes:

    <input type="checkbox" class="checkbox" name="box[]" value="1">One</input>
    <input type="checkbox" class="checkbox" name="box[]" value="2">Two</input>
    <input type="checkbox" class="checkbox" name="box[]" value="3">Three</input>
    
    

     

     

    Then I'd have a code like this, which is obviously wrong hence I wrote it for illustration only, it should also have an explode function for the delimiter:

    if (isset($_POST['box'])) {
    $newbox = array();
    foreach($_POST['box'] as $boxArr){
    array_push($newbox, $boxArr);
    }
    
    $query="INSERT INTO boxesTable (boxes) VALUES ('$newbox')";
    
    }
    

     

    Any help would be much appreciated.

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