Reputation: 15
I just want to add some extra text on top of input posted from a form as per the example below:
$username = $_POST['username'];
$sql = mysql_query("INSERT INTO customers (Username) VALUES('$username')");
But I want the value into the table as:'username*text' That is if user input a username as 'john', I want to get it entered into the table as 'john*text'.
Thanx in advance.
Upvotes: 0
Views: 111
Reputation: 3622
USE:
$username = $_POST['username'].'*text';//hence you get *text postfix to every value
$sql = mysql_query("INSERT INTO customers (Username) VALUES('$username')");
now check your result,it will definitely work.
Upvotes: 0
Reputation: 4689
try:
$username = mysql_real_escape_string($_POST['username']) ."*text";
Do escape the user's input to avoid sql injection
Upvotes: 3