php - I have a website which contains textbox, the data entered in the text box should be imported to database -


i have created database named idea , table named user_tndrequest , connection part done, have done following coding part, when enter text in text box, output after clicking on submit button results in error, please me this.

<?php     require_once('auth.php'); ?> <html>     <h2 align="center"> tnd request </h2>     <h3 align="center">         <form method="post"  action="database2.php">             <p><textarea name="inputtxt" cols=40 rows=8></textarea></p>             <input type="submit" value="submit" />             <p align="center"><a href="index.php">logout</a></p>         </form>     </h3> </body > 

code database2:

<?php     define('db_name','idea');     define('db_user','root');     define('db_password','');     define('db_host','localhost');          $link=mysql_connect(db_host,db_user,db_password);      if (!$link)     {         die('couldnot connetc:'.mysql_error());     }      $db_selected=mysql_select_db(db_name,$link);     if (!$db_selected)     {         die('cant connect db');     }      $value=$_post['inputtxt'];     $sql="insert user_tndrequest (inputtxt) values ('$value')";     if (!mysql_query($sql)) {         die('error');         # code...     }      $dbc = mysqli_connect(db_host, db_user, db_password, 'inputtxt');     $query = "select * user_tndrequest";      $result = mysqli_query($dbc, $query);     //echo var_dump($result);     $temp = 0;     $colour = "blue";     $array_len = mysqli_num_rows($result);     //echo $array_len;     while ($row = mysqli_fetch_array($result)) {         if ($temp == $array_len - 1) {                        echo '<p>'.'<center>'.'<font face="helvetica">'.'<font size="7">' .  $row['inputtxt'] .'</font>'. '</font>'.'</center>' . '</p>';         }         $temp++;     }     mysql_close(); ?> 

are talking single database here? auth.php contain?


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -