Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-24-2006, 09:04 AM   #1 (permalink)
quiztoon
Junior Member
 
Join Date: Mar 2006
Posts: 1
Smile Beginner Help

Hi all

I am real new to all this and a little confused on how to make forms work with php and html. I followed what I thought was a tutorial on this only to find that the last chapter was missing and consequently got nowhere.

I have bought a book but it is a bit too advanced for me using terminology I dont yet understand and follow.

I was wondering if someone could either point me in the direction of some easy to understand tutorials for basic form etc, or if someone could maybe write the script and html parts so that I can dissect them and understand what is going on.

Hopefully someone will take pity on this old guy and spread some programming skills around

Thanks in advance
quiztoon is offline   Reply With Quote
Sponsored Links
Old 04-02-2006, 09:31 AM   #2 (permalink)
welstein
Junior Member
 
Join Date: Apr 2006
Posts: 2
Default Re: Beginner Help

<!-- this is your first html file -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="EditPlus">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK rel="stylesheet" type="text/css" name="MyCSS" href="css.css">
</HEAD>
<BODY>

<FORM method="post" action="adminlogin.php">
<TABLE border="1" width="40%" align="center" cellpadding="0" cellspacing="1">
<TR>
<TD width="1%" nowrap>User name</TD>
<TD width="2px">:</TD>
<TD><INPUT type="text" name="txtUserName" style='width:183px' /></TD>
</TR>
<TR>
<TD>Password</TD>
<TD>:</TD>
<TD><INPUT type="password" name="txtPassword" style='width:183px'" /></TD>
</TR>
<TR>
<TD colspan="3" align="center"><INPUT class="button" type="Submit" name="btnSubmit" value="Login"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>


<!-- this is your adminlogin.php file -->
<?php
// use this post to get the value ..if your form method=post
// if your form's method=get then you have to use $_GET in order to get your html value
extract($_POST);
//$txtUserName will get your textbox value for txtUserName
print("User name - " . $txtUserName);// print the value on the HTML page
//or you can use echo to display the message as well
echo "Password - $txtPassword";
// after that you can either match the value with your database.....
// happy programming ^^
?>
welstein is offline   Reply With Quote
Old 04-18-2006, 02:23 PM   #3 (permalink)
gk_awadhiya
Junior Member
 
Join Date: Apr 2006
Posts: 1
Cool Re: Beginner Help

Quote:
Originally Posted by welstein
<!-- this is your first html file -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="EditPlus">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK rel="stylesheet" type="text/css" name="MyCSS" href="css.css">
</HEAD>
<BODY>

<FORM method="post" action="adminlogin.php">
<TABLE border="1" width="40%" align="center" cellpadding="0" cellspacing="1">
<TR>
<TD width="1%" nowrap>User name</TD>
<TD width="2px">:</TD>
<TD><INPUT type="text" name="txtUserName" style='width:183px' /></TD>
</TR>
<TR>
<TD>Password</TD>
<TD>:</TD>
<TD><INPUT type="password" name="txtPassword" style='width:183px'" /></TD>
</TR>
<TR>
<TD colspan="3" align="center"><INPUT class="button" type="Submit" name="btnSubmit" value="Login"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>


<!-- this is your adminlogin.php file -->
<?php
// use this post to get the value ..if your form method=post
// if your form's method=get then you have to use $_GET in order to get your html value
extract($_POST);
//$txtUserName will get your textbox value for txtUserName
print("User name - " . $txtUserName);// print the value on the HTML page
//or you can use echo to display the message as well
echo "Password - $txtPassword";
// after that you can either match the value with your database.....
// happy programming ^^
?>

Hi friend,

thanks for the 1st page. I'm also a bigginer for php.

But this page is writtern by you whereas what if any other person want to write his first page? Just copy and paste your page?

I'm not critising you. Just we like to know how this page is writtin? Some basics only.

Highly expect more help from you.
__________________
http://iincome4u.com
gk_awadhiya is offline   Reply With Quote
Old 05-06-2006, 03:29 PM   #4 (permalink)
etono
Moderator
 
Join Date: May 2006
Posts: 86
Lightbulb Re: Beginner Help

Hello,

I am sure welstein meant for you to copy and paste the code he gave you, but I will attempt to give you a little more description on how to do this. Basically you have two pages: an html page and a php page.

We will start with the html page. On the html page, you are providing a form to be filled out. The basic html page markup looks like this:
Code:
<html> <head> <title>My Form</title> </head> <body> This is where our form will go </body> </html>
Now for the form markup. We will just have two inputs, one is for entering a name, and the other is for displaying a submit button. The basic form format is:
Code:
<form action="myphppage.php" method="post"> Your Name: <input type="text" name="person_name" /><br /> <input type="submit" value="Submit Form" /> </form>
As you can see the form tag contains and action and a method. The action specifies the file that will receive the information that is filled out in the form, the method specifies how it will receive the information. Also notice that our first input is specified as a type of text which means it will display a textbox and its name is specified as person_name which is how we will reference the information entered when we are writting the php page. The second input is of type submit which will display a submit button, and it's value is the message displayed on the button which in this case is simply Submit Form. So, let's name our html page contact.html, the final markup:
Code:
<html> <head> <title>My Form</title> </head> <body> <p>Please fill out the form below:</p> <form action="contact.php" method="post"> Your Name: <input type="text" name="person_name" /><br /> <input type="submit" value="Submit Form" /> </form> </body> </html>

OK, now moving on to the contact.php page. The basic php page looks like this:
Code:
<?php //This is where your code goes ?>
The opening and closing php tags are specifying that this contains a php script. The two slashes is a comment, and are not parsed, meaning that it just helps explain the code, but doesn't actually do anything. As our method is post we will access our person_name textfield like so:
Code:
<?php //display the person's name echo "Hello " . $_POST['person_name'] . "! Thank you for filling out the form."; ?>
The echo statement is dispaying the text to the screen. Within the double quotes is text that will be displayed, the dot is appending (or adding) to whatever is currently there. This is just a simple example of how to receive the form variable, but you would likely want to store your values to a database or send them off in an email, we are just showing them on the screen.

For html tutorials I would highly recommend w3schools.com. It goes step by step and shows tons of examples. For php help I am not too familiar with good tutorial sites out there. I am sure they are available though and maybe others can reply to this with their recommendations. I started a site radiophp.com which has an audio podcast on it going through this same type of example. I have definatly neglected the site though, and have not created any new tutorials, but hopefully that will soon change.

Cheers.
etono is offline   Reply With Quote
Old 06-22-2006, 01:36 PM   #5 (permalink)
ManForse
Junior Member
 
Join Date: Jun 2006
Posts: 1
Post Somesing for you

wowww I love
love you all!
ManForse is offline   Reply With Quote
Old 08-19-2006, 07:58 AM   #6 (permalink)
8ta8ta
Junior Member
 
Join Date: Aug 2006
Posts: 25
Default Re: Beginner Help

php.net/docs.php is the best way to study php!
8ta8ta is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 10:50 AM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums