Jump to content

I Need Help With A Very Simple Form Please


jester420247

Recommended Posts

All I am trying to do is take the input from the 2 text boxes and write them to my database. Then I would like a page to view all the data in the table. I am trying to store a mailing list for my website. Any help will be greatly appreciated.

[code]<?php     
$self = $_SERVER [ ' PHP_SELF ' ] ;
$email = $_POST [ ' email ' ] ;
$name = $_POST [ ' name ' ] ; 
?>

<form action="<?php echo( $self ) ; ?>" method="post">
email: <input type="text" name="email" size="8">
name: <input type="text" name="name" size="8"><input type="submit" value="Submit"> </form>



<?php
if( $email and $name )
{$conn = @mysql_connect( "mysql187.secureserver.net", "user", "password" ) or die ( "Err : Connv" ) ;
$rs = @mysql_select_db( "emailaddresses", $conn ) or die ( "Err: DB" ) ;
$sql= "INSERT INTO into emailaddresses  (email, name) values ('$email', '$name')";
mysql_query($query);
$rs + mysqlquery( $sql, $conn );}
if($rs){echo ("Record added:$name,$email" ); }
?> [/code]

Archived

This topic is now archived and is closed to further replies.

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