hello
I have a HTML page and I want to add this to it ( like explained in the picture ) . I can do HTML but I don't know a lot about PHP and how to connect it with MySQL. I need to put the code on my HTML page and when people press the add botton , the script test the boxes and see if the " E-mail " is real and if the other boxes are filled or not then IF everything is good , It sends the " Email " boxe , the " Number " boxe , and the " comment '' boxe to my SQL database. All what I can do is add the name and the password of the database to the script.
I really need help.
And thank you very very very much in advance
I tried this but it didn't work or maybe I didn't knew how to add it to my HTML page
So , anyone can help please
I have a HTML page and I want to add this to it ( like explained in the picture ) . I can do HTML but I don't know a lot about PHP and how to connect it with MySQL. I need to put the code on my HTML page and when people press the add botton , the script test the boxes and see if the " E-mail " is real and if the other boxes are filled or not then IF everything is good , It sends the " Email " boxe , the " Number " boxe , and the " comment '' boxe to my SQL database. All what I can do is add the name and the password of the database to the script.
I really need help.
And thank you very very very much in advance
I tried this but it didn't work or maybe I didn't knew how to add it to my HTML page
Code:
<? php
// Connects to your Database
mysql_connect("Host", "user", "pass") or die(mysql_error());
mysql_select_db("Database") or die(mysql_error());
//This makes sure they did not leave any fields blank
if (!$_POST['email'] | !$_POST['number'] | !$_POST['comment'] ) {
die('Please Complete All the Fields.');
}
if (strpos($_POST['email'], '@') === false) {
print 'This is not a valid email adress';
}
if (isset($_POST['add'])) {
// now we insert it into the database
$insert = "INSERT INTO tb_users (email, number, comment )
VALUES ('".$_POST['email']."' , '".$_POST['number']."' , '".$_POST['comment']."' )";
$add_member = mysql_query($insert);
}
?>
<?php
echo("<p>Thank you for you're comment <p/>");
}
else
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="email" maxlength="20">
<input type="text" name="number" maxlength="10">
<input type="text" name="comment" cols="20" rows="10" maxlength="100">
<input type="submit" name="add" value="Add">
<?
}
?>
So , anyone can help please