I have a script which takes the variable from a form and puts it into a mysql table.

There is an entry, but inside the field it is blank.

I have attached screenshots.

This is my code

// prepare form values for insert
$URL = mysql_real_escape_string($_POST['url']);

// Make mysql connection below

$sql = "INSERT INTO `addurl` (`u_link`) VALUES ('$URL')";
$res = mysql_query($sql) or die(mysql_error());
  if(!$res){
  echo "Could not enter data";
  } else {
  echo "data entered into database";
  }
  ?>
</html>

Get rid of the single quotes around your table name and field name. $sql = "INSERT INTO addurl (u_link) VALUES ('$URL')";

It still shows a blank field. The thing i don't understand is that it registers the entry, just its blank.

I got it. I had named a variable wrong. Nevermind.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.