1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to: Let a user submit data to a mysql row but accept or decline it first?

Discussion in 'PHP' started by Pizzaman1123, Jan 6, 2013.

  1. #1
    I would like to know how to let a user submit data to a mysql row in php but only if it is accept or declined by me first. I'd also like to know if this is possible without a log-in system, if so do you know of a script that I could possibly use?
     
    Pizzaman1123, Jan 6, 2013 IP
  2. kodut

    kodut Well-Known Member

    Messages:
    2,738
    Likes Received:
    76
    Best Answers:
    1
    Trophy Points:
    170
    #2
    why not allow the user to submit the form and later on accept or delete the record ......... because the data will have to be saved somewhere before you take a decision .
     
    kodut, Jan 6, 2013 IP
  3. Pizzaman1123

    Pizzaman1123 Peon

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That is a good idea. That sounds pretty simple and something I'm capable of too since I know little php. I believe I'll have to change 300+ records a day so I'm trying to get it as automated as possible.
     
    Pizzaman1123, Jan 6, 2013 IP
  4. CLMMafia

    CLMMafia Member

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #4
    I would use an ENUM of '0','1' with the default as 0. (0 = No/Off & 1 = Yes/On). Name the ENUM `accepted`.

    if(($accepted == 0) || ($accepted == '0')){
    //Not accepted.
    
    }else if(($accepted == 1) || ($accepted == '1')){
    //Accepted.
    
    }
    PHP:
    If you tell us more, or even show some code that your site is using it would help us, help you.
     
    CLMMafia, Jan 7, 2013 IP
  5. Pizzaman1123

    Pizzaman1123 Peon

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    <?php
    //**************************************
    // Page load dropdown results //
    //**************************************
    function getTierOne()
    {
    $result = mysql_query("SELECT DISTINCT tier_one FROM three_drops ORDER BY tier_one ASC")
    or die(mysql_error());

    while($tier = mysql_fetch_array( $result ))

    {
    echo '<option value="'.$tier['tier_one'].'">'.$tier['tier_one'].'</option>';
    }

    }

    //**************************************
    // First selection results //
    //**************************************
    if ( isset($_GET['func']) && ($_GET['func'] == "drop_1") ) {
    drop_1($_GET['drop_var']);
    }


    function drop_1($drop_var)
    {
    include_once('db.php');
    $result = mysql_query("SELECT DISTINCT tier_two FROM three_drops WHERE tier_one='$drop_var'")
    or die(mysql_error());

    echo '<select name="drop_2" id="drop_2">
    <option value=" " disabled="disabled" selected="selected">Choose one</option>';

    while($drop_2 = mysql_fetch_array( $result ))
    {
    echo '<option value="'.$drop_2['tier_two'].'">'.$drop_2['tier_two'].'</option>';
    }

    echo '</select>';
    echo "<script type=\"text/javascript\">
    $('#wait_2').hide();
    $('#drop_2').change(function(){
    $('#wait_2').show();
    $('#result_2').hide();
    $.get(\"func.php\", {
    func: \"drop_2\",
    drop_var: $('#drop_2').val()
    }, function(response){
    $('#result_2').fadeOut();
    setTimeout(\"finishAjax_tier_three('result_2', '\"+escape(response)+\"')\", 400);
    });
    return false;
    });
    </script>";
    }


    //**************************************
    // Second selection results //
    //**************************************
    if ( isset($_GET['func']) && ($_GET['func'] == "drop_2") ) {
    drop_2($_GET['drop_var']);
    }


    function drop_2($drop_var)
    {
    include_once('db.php');
    $result = mysql_query("SELECT * FROM three_drops WHERE tier_two='$drop_var'")
    or die(mysql_error());


    while($drop_3 = mysql_fetch_array( $result ))
    {
    echo $drop_3['tier_three'];
    }

    echo '</select> ';
    }
    ?>

    Here is the function file. I have a 2nd question too. This is a chained dropdown box and on the third chain it echo $drop_3['tier_three']; and this is just pulling all of data from "tier_three" rather than just pulling one row from "tier_three" that is related to dropdown box one and two. here is a img to explain it better [​IMG]
     
    Pizzaman1123, Jan 7, 2013 IP
  6. Pizzaman1123

    Pizzaman1123 Peon

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I still need help :)
     
    Pizzaman1123, Jan 8, 2013 IP
  7. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #7
    Much as I'm sure we'd all like to help you out, we are only human, and most of us males at that ( and our significant others and or mothers will tell you that makes us lazy ).

    We do not recognize your post as code, and or cannot be bothered to make it readable. Get used to wrapping code in the correct forum markup, and or posting on htp://pastebin.com, or the wonderful gist feature of github; make it easy to read and it will be read ...
     
    krakjoe, Jan 8, 2013 IP