Hello
I'm learning a little of
PHP and Mysql. What I’m trying to do is to create a small web form and save the information receive on a data base.
I was reading about mysql, in order to save the data I’ll get from this form, i have to create a data base, after that make the connection between the
php and the dada base.
What I don't get is how save the information on the data base. I mean, all the code has to be in the main
php?.
I have this so far.
Is not good, i'll make it look better (Sorry is the first time i do this).
By the way i'm using Xampp.
I will appreciate if some one can help me out.
----------------------
CREATE TABLE test (
ID_test int(11) DEFAULT '0' NOT NULL auto_increment,
name varchar(100),
email varchar(100),
PRIMARY KEY (ID_test),
UNIQUE ID_Prueba (ID_test)
);
$link = mysql_connect('localhost', 'mytestuser', 'test');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
<
HTML><BODY>
<FORM METHOD="post" ACTION="<?
PHP echo $PHP_SELF ?>">
<p>Name: <input type="text" name="name" size="30" name" size="30" value="Name.."></p>
<p>E-Mail: <input type="text" name="email" size="30" email" size="30" value=""></p>
<p>Department:
<select size="1" name="Department">
<option selected value="Select">Select</option>
<option value="One">One</option>
<option value="Two">Two</option>
</select></p>
<p>Subject: <input type="text" name="subject" size="30" name" size="30" value="Subject.."></p> <p>Comment:</p>
<p><textarea rows="5" name="comment" cols="28"></textarea></p>
<p>Assign:</p>
<select size="1" name="Assign:">
<option selected value="Select">Select</option>
<option value="One">OneA</option>
<option value="Two">TwoA</option>
</select></p>
<p><input type="submit" value="Send" name="Send">
<input type="
reset" value="Delete" name="B2"></p>
</FORM>
</BODY>
</
HTML>
<?
PHP