Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > PHP

Reply
 
LinkBack Thread Tools
Old January 5th, 2010, 09:08 AM   #1
New Member
 

Join Date: Jan 2010
Location: australia
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 alass is on a distinguished road
Question PHP Example

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
alass is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0 RC8