faces3 Posted April 24, 2013 Share Posted April 24, 2013 Problem with get data form and add database. Its all in same page. <form action= "" method="post"> <input type="text" name = "database" size="30" /> <input type="text" name = "firma" size="30" /> <input type="text" name = "telefon" size="30" /> <input type="text" name = "email" size="30" /> <input type="text" name = "koduleht" size="30" /> <input type="text" name = "kontakt" size="30" /> <input type="text" name = "aeg" size="30" /> <input type="submit" value="Add" /> </form> <?php $tabel = $_REQUEST['database']; $firma = $_REQUEST['firma']; $tel = $_REQUEST['telefon']; $email = $_REQUEST['email']; $kontakt = $_REQUEST['kontakt']; $con=mysqli_connect("localhost","root","kala", $tabel); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } INSERT INTO $tabel (firma, telefon, email, kontakt) VALUES ('$firma' , '$tel' , '$email' , '$kontakt'); mysqli_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/277264-problem/ Share on other sites More sharing options...
computermax2328 Posted April 24, 2013 Share Posted April 24, 2013 You are using single page submission, which is fine, but right now you are telling your for to do nothing. <form action= "" method="post"> Tell it to execute this page. You can also look at this if you want, but I don't see the point of using it. Maybe someone else could explain.http://www.html-form-guide.com/php-form/php-form-action-self.html Link to comment https://forums.phpfreaks.com/topic/277264-problem/#findComment-1426384 Share on other sites More sharing options...
Jessica Posted April 24, 2013 Share Posted April 24, 2013 On 4/24/2013 at 7:10 PM, computermax2328 said: You are using single page submission, which is fine, but right now you are telling your for to do nothing. <form action= "" method="post">Tell it to execute this page. You can also look at this if you want, but I don't see the point of using it. Maybe someone else could explain. http://www.html-form-guide.com/php-form/php-form-action-self.html That is fine, it will submit to the page it's already on. The problem is the OP didn't actually state a problem. Link to comment https://forums.phpfreaks.com/topic/277264-problem/#findComment-1426392 Share on other sites More sharing options...
computermax2328 Posted April 24, 2013 Share Posted April 24, 2013 He doesn't run a mysqli query?? <?php $tabel = $_REQUEST['database']; $firma = $_REQUEST['firma']; $tel = $_REQUEST['telefon']; $email = $_REQUEST['email']; $kontakt = $_REQUEST['kontakt']; $con=mysqli_connect("localhost","root","kala", $tabel); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } INSERT INTO $tabel (firma, telefon, email, kontakt) VALUES ('$firma' , '$tel' , '$email' , '$kontakt'); mysqli_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/277264-problem/#findComment-1426396 Share on other sites More sharing options...
Jessica Posted April 24, 2013 Share Posted April 24, 2013 Yeah that would be it. Link to comment https://forums.phpfreaks.com/topic/277264-problem/#findComment-1426397 Share on other sites More sharing options...
faces3 Posted April 24, 2013 Author Share Posted April 24, 2013 What must do then? Link to comment https://forums.phpfreaks.com/topic/277264-problem/#findComment-1426449 Share on other sites More sharing options...
Jessica Posted April 24, 2013 Share Posted April 24, 2013 Put your query in a string and execute it. mysqli_query Link to comment https://forums.phpfreaks.com/topic/277264-problem/#findComment-1426450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.