Jump to content

cmm8907

New Members
  • Posts

    2
  • Joined

  • Last visited

cmm8907's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. im going to be honest becuase this is all new to me so i dont really know how to do any of that. any way you could throw the code together for me and i can past it in and test it?
  2. Need help ASAP. i need the following form to right to mysql table "table1" and columns "name" "email" and "comment". <form action="sign.php" method="post" class="pure-form pure-form-stacked"> <fieldset> <label for="name">Your Name</label> <input id="name" type="text" placeholder="Your Name" name="name"> <label for="email">Your Email</label> <input id="email" type="email" placeholder="Your Email" name="email"> <label for="comment">Your Comments</label> <input id="comment" type="text" placeholder="Your Comments" name="comment"> <a href="thanks.html" button type="submit" class="pure-button">SUBMIT</button> </a> </fieldset> </form> My PHP File looks like this: <html> <body> <?php $myUser = "dbuser"; $myPassd = "********"; $myDB = "dbname"; $myserver = "192.168.1.80:3306"; $name = $_POST['name']; $email = $_POST['email']; $comment = $_POST['comment']; // Create connection $dbhandle = mysql_connect($myserver,$myUser,$myPassd) or die("Unable to connect to MySQL"); echo "Connected to MySQL<br>"; //select a database to work with $selected = mysql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); //if (mysqli_connect_errno()) { //echo "Failed to connect to MySQL: " . mysqli_connect_error(); //} //echo "connected"; $sql = "INSERT INTO signatures (name, comment) VALUES ( $name, $comment)"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "record added"; mysql_close($dbhandle); ?> </body> </html> I also need this to redirect to another html page after it run. Like i said any help would be great because i cant get it to work!
×
×
  • 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.