Eviltechie
September 26th, 2009, 06:37 PM
I'm trying to make a php script to insert some data into a table, but it doesn't seem to be working.
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$song = $_POST['song'];
$artist = $_POST['artist'];
$client_ip = $_SERVER['REMOTE_ADDR'];
$name = mysql_real_escape_string($name);
$email = mysql_real_escape_string($email);
$song = mysql_real_escape_string($song);
$artist = mysql_real_escape_string($artist);
mysql_query('INSERT INTO request (name, email, song_name, artist_name, ip_address) VALUES($name, $email, $song, $artist, $client_ip) ') or die(mysql_error());
echo "Request succesfully submitted";
?>
The mysql query is the offending line of code.
You can view the html for the form here. http://trilug.pastebin.com/f4322521b
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$song = $_POST['song'];
$artist = $_POST['artist'];
$client_ip = $_SERVER['REMOTE_ADDR'];
$name = mysql_real_escape_string($name);
$email = mysql_real_escape_string($email);
$song = mysql_real_escape_string($song);
$artist = mysql_real_escape_string($artist);
mysql_query('INSERT INTO request (name, email, song_name, artist_name, ip_address) VALUES($name, $email, $song, $artist, $client_ip) ') or die(mysql_error());
echo "Request succesfully submitted";
?>
The mysql query is the offending line of code.
You can view the html for the form here. http://trilug.pastebin.com/f4322521b