boredemt boredemt - 1 year ago 54
SQL Question

Submit variable in URL to MySQL Database

I would like to have a page that, when someone clicks a pre-formatted link I've sent, writes a variable in the URL to a MySQL database and just displays "Thank You" or something to the user.


The user would click a link formatted something like

When the page loads the 12345 would be written to a table in a MySQL database, it would show a Thank you, and that is it.

Seems like it should be simple enough but I can't find anything on it. I'm probably searching wrong, since this is all new to me.

Answer Source

User $_GET to retrive the value and put into your table. Example:

code inside click.php

$sql="Insert into table1 VALUES ($id)";
echo "<script>alert('Thank you')</script>";