-1

my button is not submiting and i do not know why, had some friend look over it and they dont see whats wrong. the function is to change the date you have orderd a flight ticket

     print ("<from method='post' action=''>");
            print ("Ny utreisedato <input type='text' value='$utreisedato' name='utreisedato' id='utreisedato' >");
            print ("Ny returdato<input type='text' value='$retur' name='retur' id='retur' >");
            print ("<input type='submit' value='Endre dato' name='endredato' id='endredato'>");
            print ("</form>");
        }


@$endredato=$_POST["endredato"];
if ($endredato)
{

$utreisedato=$_POST["utreisedato"];
$retur=$_POST["retur"];

    if (!$utreisedato || !$retur)   {
    print ("Alle feltene må være fyllt ut!");
    }
            else {


        $sqlSetning = "UPDATE reiser SET utreisedato='$utreisedato', retur='$retur' WHERE tlf='$tlf';";
        mysqli_query($db,$sqlSetning) or die ("kunne ikke endre informasjonen");

        print ("Reisen med nummer $tlf er endret. Last inn siden på nytt for å se forandringen i tabellen.");
    }
    }

?>
darthwiper
  • 9
  • 2
  • 7
  • 1
    **Danger**: You are **vulnerable to [SQL injection attacks](http://bobby-tables.com/)** that you need to [defend](http://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php) yourself from. – Quentin Jun 08 '16 at 09:30
  • You are using variable `$tlf` which I can not see in this code to be initialized. – nospor Jun 08 '16 at 09:30
  • 1
    "my button is not submiting" — What does this mean? Does clicking on it do nothing at all? Does it trigger a POST request but not submit any data? Does it trigger a POST request, with data, but the test `if ($endredato)` gives an expected result? Use the Network tab in the developer tools of your browser. Figure out what is actually happening. – Quentin Jun 08 '16 at 09:31
  • i click it and nothing happens – darthwiper Jun 08 '16 at 09:37
  • @darthwiper — Nothing at all? So you have looked at the Network tab in your developer tools and no request is made? – Quentin Jun 08 '16 at 09:39
  • try removing value part `value='Endre dato'` and check through `if($_POST["endredato"])` – Abhishek Gurjar Jun 08 '16 at 09:40

1 Answers1

2

I am sure that problem because of you type wrong for form tag. for this line print ("<from method='post' action=''>"); you should write print ("<form method='post' action=''>");.

Hopefully it will be success.