Jump to content

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=test@test.net&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].

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.