Form Field to Settings - What am I doing wrong?

Discussion in 'PHP' started by goneinsane, Sep 3, 2010.

  1. #1
    I have made a field in a form that is saved to the database.
    <input type="text" name="dau" class="text" value="<?php echo $settings['dau'] ?>" />
    Code (markup):
    In this code, I would like to replace the number 55 with the information that is placed in the field and saved to the database from the first example.
    $insert = $db->query_insert("tickets",$data);
    mysql_query("INSERT INTO `important`.`support_assigned` (`ID` ,`USER_ID` ,`TICKET_ID` ,`date`) VALUES (NULL , '55', '".$insert."',CURRENT_TIMESTAMP)");
    Code (markup):
    Anyone know how I can do this?

    Thank you in advanced.
     
    goneinsane, Sep 3, 2010 IP
  2. krishmk

    krishmk Well-Known Member

    Messages:
    1,376
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    185
    #2
    Capture the value of form field thru
    $dau_value = $_POST['dau'];


    Replace "55" with the variable "$dau_value"
     
    krishmk, Sep 3, 2010 IP
  3. php-lover

    php-lover Active Member

    Messages:
    261
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    58
    #3
    $dau = $_POST['dau']; 
    
    mysql_query("INSERT INTO `important`.`support_assigned` (`ID` ,`USER_ID` ,`TICKET_ID` ,`date`) VALUES (NULL , ".$dau.", '".$insert."',CURRENT_TIMESTAMP)");
    PHP:

    Finau
     
    Last edited: Sep 3, 2010
    php-lover, Sep 3, 2010 IP
  4. goneinsane

    goneinsane Well-Known Member

    Messages:
    303
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    130
    #4
    Neither one of these worked. Doesn't it have to call it from the right spot in the database and not just dau? It's in a spot named Settings.
     
    goneinsane, Sep 4, 2010 IP
  5. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #5
    On your <form what is the method ? is it get or post and is there an action=, if so what is that action ?
     
    MyVodaFone, Sep 4, 2010 IP
  6. goneinsane

    goneinsane Well-Known Member

    Messages:
    303
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    130
    #6
    Here's what the file with the form says:
    
    if (isset($_POST['submit'])) {
    	
    	$q15 = $db->query("UPDATE ".DB_TABLE."settings SET value = '".trim($_POST['dau'])."' WHERE name = 'dau';");
    Code (markup):
    Here's what's in the form:

    <input type="text" name="dau" class="text" value="<?php echo $settings['dau'] ?>" />
    Code (markup):
     
    goneinsane, Sep 4, 2010 IP