Jump to content

Passing a variable from form to db


ravravrav

Recommended Posts

I have a page called skills.html where i can add skills to my skills table.

<form action="addskill.php" method="post">
Skill name: <input type="text" name="skillname"><br />
Skill description: <input type="textarea" rows="5" cols="20" name="description"><br />
<input type="Submit">

I want to pass skillname and description to addskill.php so that it can add them to the database... how do I do this?

This is what I've got so far for addskill.php:

<?php
$username="x";
$password="x";
$database="x";

mysql_connect(localhost,$username,$password);

mysql_close();

@mysql_select_db($database) or die( "Unable to select database");

mysql_query($query);

$query = "INSERT INTO skills VALUES ('',$skillname, $description)";
?>

What's the correct way :-\?? Thx
Link to comment
https://forums.phpfreaks.com/topic/28227-passing-a-variable-from-form-to-db/
Share on other sites

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.