Home Database values not showing on php server
Reply: 1

Database values not showing on php server

Mubashir Maqbool
1#
Mubashir Maqbool Published in 2018-01-13 10:56:17Z

This question already has an answer here:

  • When to use single quotes, double quotes, and backticks in MySQL 10 answers
  • How to get mysqli error in different environments? 1 answer

I am new to PHP and web and I am trying to input values from HTML form.

The values that I input on HTML form are not showing on XAMPP server. How can I see them.

Below is the code I wrote to do that.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php

$conn=mysqli_connect('localhost','root','');
if(!$conn)
{  echo"not connected";}
if(!mysqli_select_db($conn,'students'))
{echo"not selected";}

     $a=$_POST["uname"];
     $b=$_POST["fname"];

       $sql="INSERT INTO data(Name,Father Name) VALUES('$a','$b')";
       if(!mysqli_query($conn,$sql))
       {   echo" data inserted successfully ";}
       header("refresh:5;url=index.html");
?>      




</body>

I am getting following output. Output

Chris Muga
2#
Chris Muga Reply to 2018-01-13 12:05:35Z

try changing all the data types of the fields on your table to VARCHAR

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.502265 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO