Jump to content

Php Feedack Form URL Submit


rog1121

Recommended Posts

I have a Feedback form that I use to get peoples input. So far it works But I have 2 Problems

 

Here is the Code:

<?php
include "includes/config.php";
$date   = date('jS \of F  h:i A');



$sql="INSERT INTO news (name, email, comments, date)
VALUES
('$_POST[Name]', '$_POST[email]', '$_POST[comments]', '$date')";

header( 'Location: thanks.php' );

mysql_close($con)
?>

 

I'm making a VB.net Feedback form and I want to imput like this

 

http://mysite.com/feedback.php?name=Mike&[email protected]&comments=comment&date=20th of April  12:30 AM

 

But so far from my testing it doesn't register the values and says that there is a Duplicate value for email ".

 

I'd like it to register values somehow and if there is a duplicate email entered then have it update it or write over it.

 

Any help appreciated,

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/234707-php-feedack-form-url-submit/
Share on other sites

There is nothing wrong or insecure about sending data through GET, as long as you are not sending sensitive data like password or anything.

 

To secure your code from sql injection attacks, you have to sanitize the user input variables before using them in query. For mysql, you can use php's addslashes() or mysql_real_escape_string to escape special characters.

 

By the way, it is better to use $_POST['Name'] instead of $_POST[Name].

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.