Jump to content

Problem...


faces3

Recommended Posts

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

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

  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

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

Archived

This topic is now archived and is closed to further replies.

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