Click here to Skip to main content
15,749,352 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi all

Could anyone please help me.

I am building a PHP website and created my database on phpMyAdmin. I created a database called maxipakdb and withing that a table called maxipak table.

When I type in data, for example, my email on the webpage I am creating, it displays on phpMyAdmin, but instead of showing the actual email I typed in, on my database, it shows as &email. Can anyone tell me why?

Please see my code below. Everything is working 100% until I want to see what emails have subscribed on my database.

    /* Database config */
$db_host        = 'localhost';
$db_user        = 'root';
$db_pass        = '';
$db_database    = 'maxipakdb'; 
/* End config */

$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_database);

/* check connection */
if (mysqli_connect_errno()) {printf("Connect failed: %s\n", mysqli_connect_error());}

$email = $_POST['email'];

// Perform queries 

mysqli_query($mysqli, "INSERT INTO maxipaktable (id,email) VALUES (NULL,'&email')");

header('Location: success.php');

echo $email;

What I have tried:

I haven't tried much really because I am stuck. I have tried to google possible solutions but I am not to sure how to word it for google. I am still new to programming.
Updated 22-May-16 8:14am

1 solution

&email != $email
Share this answer
Member 12539141 22-May-16 14:22pm    
So simple, I don't know how I missed that. Thank you
Kornfeld Eliyahu Peter 22-May-16 14:24pm    
It is a known effect of too focused brain - you have to take a step back (drink a coffee), relax and you will see it all alone too...
Sergey Alexandrovich Kryukov 22-May-16 21:05pm    
Ha-ha, a 5. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900