MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides  
Homepage Register FAQ Members Mark Forums Read Advertise Marketplace FPSowned


Go Back   MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides > Programming > Server side > PHP
Reload this Page [Tutorial] Extreme guide in php
PHP Discussions about PHP

Reply
 
LinkBack Thread Tools
[Tutorial] Extreme guide in php
(#1)
Old
Promthian is Offline
Site n00b.. (A leecher if I've been here for more than a month and can't earn 5 rep)
Rep Power: 1
Reputation: 2
Promthian is an unknown quantity at this point
 
Posts: 5
Join Date: Aug 2008
Wow Guides [Tutorial] Extreme guide in php - 08-31-2008

Documentation sections


Introduction
Variables
Using Forms
Sending Email
MySQL Databases

This feature is ready for use on all hosting accounts at no extra cost.




1. Introduction

All hosting plans have PHP enabled by default. There is no need to install or enable anything extra. Unlike cgi scripts, no special permissions are required.

Simply give your PHP pages a .php extension and upload them to your web site. Think of these files as regular .html files with a special set of features.

First Example

<html>
<head><title>First Example</title></head>
<body>
<?php
echo "Our first example<br>";
?>
</body>
</html>




The php code starts with <?php and ends with ?>.

When someone points a browser to this web page, the server will convert the .php code and output the below.

<html>
<head><title>First Example</title></head>
<body>
Our first example
</body>
</html>




In other words, it will display a web page with the words "First Example" in the title and the phrase "Our first example" on the page itself.

Included at no extra cost with each hosting account, PHP allows you to make your web site more dynamic.



2. Documents


An html web page is basically a plain text (ASCII) file. It can be created/modified using any basic text editor.

1. Basic structure

The HTML tag starts and stops the web page. Different sections are defined within the web page.

<HTML>
<HEAD>
Header info for the page goes here
</HEAD>
<BODY>
Page body/text/content goes here
</BODY>
</HTML>



The HEAD html tag starts and stops header info which may or may not be visible to the browser.

The BODY tag starts and stops the part of the web page which will be shown in your browser's window.

2. Header section

This section holds the title of the page and information which tells search engines more about the web page.

2.1 Document title

The TITLE tag defines the title for the html document.

<HEAD>
<TITLE>Beginner html guide</TITLE>
</HEAD>




This would set the title of the page (shown in the top part of your browser window) to 'Beginner html guide'. This tag is placed within the HEAD section.

2.1 Meta tags

These tags come in many flavors. This beginner's guide only covers search engine related META tags.

<HEAD>
<TITLE>Beginner html guide</TITLE>
<META NAME="description" CONTENT="This page offers html help">
<META NAME="keywords" CONTENT="html, tutorial, guide, help">
</HEAD>




The NAME attribute defines what type of info the META tag provides. The CONTENT attribute sets the value.


3. Body section

This section is what you see in the browser window. Other html tags covered in this tutorial go here.

4. Example

This sample html code sets the title for the document and adds some text as content for the page.

<HTML>
<HEAD>
<TITLE>Beginner html guide</TITLE>
</HEAD>
<BODY>
This text is shown in the browser window
</BODY>
</HTML>



Simply create a text file (with a .html extension) with the above html code and save it do disk.

You could also upload it to your web hosting account. Point a browser to it to see what it does.


3. Formatting


Many different tags are available to control text on a web page. Some of the more basic are listed here.

1. Add a line break

The BR tag is used to add a line break to a html document. Simply pressing enter will not work.


Simply pressing enter
will not result in a line break.
This <BR> tag will.



The above lines of html produces the below result.

Simply pressing enter will not result in a line break. This
tag will.



No new line was started after the word 'enter'. The line break was added where the BR html tag was placed.

2. New paragraph

The P html tag is used to insert a new paragraph.

Simply pressing enter a few times

will not insert a new paragraph.
This <P> tag will.



The above lines of html produces the below result.

Simply pressing enter a few times will not insert a new paragraph. This
tag will.




3. Bold text

The B tag is used to start/stop this formatting style.

This is an <B>example</B> of bold text.



The above line of html code produces the below result.

This is an example of bold text.



4. Italicized text

The I tag is used to start/stop this formatting style.

This is an <I>example</I> of italicized text.



The above line of html produces the below result.

This is an example of italicized text.



3. The FONT tag


The FONT tag has various attributes which can be used to change the font properties in html documents.

This tag can be used to change <FONT COLOR="red">color</FONT>, <BR>
<FONT SIZE="+1">size</FONT> and also <FONT FACE="sans-serif"> font face</FONT>.



The above lines of html produces the below result.

This tag can be used to change color,
size and also font face.



The COLOR attribute is used to change the color. The SIZE attribute can increase and decrease size. The FACE attribute defines the font face in html documents.

4. Advanced Usage


Formatting tags can be combined to help make html documents easy to read. Many other formatting tags exist, only a few are covered in this beginner's guide.




4. Tables


A table is a great way to present tabular information organized in rows and columns.

1. Table basics

The below html code defines a basic table structure.

<TABLE BORDER="1">
<TR>
<TD>Cell 1</TD>
<TD>Cell 2</TD>
<TD>Cell 3</TD>
</TR>
<TR>
<TD>Cell 4</TD>
<TD>Cell 5</TD>
<TD>Cell 6</TD>
</TR>
</TABLE>



The TABLE html tag is used to start/stop tables. By setting the BORDER attribute to "1", we add a border to a table. Set the BORDER attribute to "0" for no border.

The TR html tag is used to add a row to tables. Create data (cells) by using TD tags.

The above html would produce this table structure :

Cell 1 Cell 2 Cell 3
Cell 4 Cell 5 Cell 6


This table contains two rows with three cells each.

2. Combining cells


Two (or more) cells can be combined to make a larger cell. The html code combines two cells on the first row.

<TABLE BORDER="1">
<TR>
<TD COLSPAN=2>Cell 1</TD>
<TD>Cell 2</TD>
</TR>
<TR>
<TD>Cell 3</TD>
<TD>Cell 4</TD>
<TD>Cell 5</TD>
</TR>
</TABLE>



The COLSPAN attribute defines the number of cells to combine in this column. The html produces this table.

Cell 1 Cell 2
Cell 3 Cell 4 Cell 5


The first cell now takes up two spaces on the first column. Cells on the same row can also be combined.

<TABLE BORDER="1">
<TR>
<TD ROWSPAN=2>Cell 1</TD>
<TD>Cell 2</TD>
<TD>Cell 3</TD>
</TR>
<TR>
<TD>Cell 4</TD>
<TD>Cell 5</TD>
</TR>
</TABLE>



The ROWSPAN attribute defines the number of cells to combine in this row. The html produces this table.

Cell 1 Cell 2 Cell 3
Cell 4 Cell 5


Multiple cells can be combined across multiple rows and columns to create more complex html tables.

3. Advanced usage

Tables can be combined with html forms to create well organized, easy to use, feedback forms.

Only the basics are covered in this guide. More tags and attributes are available, backgrounds and colors can be added. This page exists to help beginners.


5. Forms



Forms allow you to gather information from your web site's visitors. These are often used for shopping carts, polls or to provide feedback. The information entered is sent to a program which in turn reads the form data.

1. Defining a form

A form starts with the below line of .html code.

<FORM METHOD="POST" ACTION="script.cgi">



The METHOD attribute tells the web server how to pass the data to the script. Usually, this is POST for forms.

Replace script.cgi with the name of your program which will receive the data from your web based form.

Forms end by closing the FORM tag, as shown below.

</FORM>



Form elements are defined between those html tags.

2. Submit button

Clicking a submit button sends the information entered in forms to the program which will handle the data.

<FORM METHOD="POST" ACTION="script.cgi">
<INPUT TYPE="submit" VALUE="Send Information">
</FORM>



This will create a button with the text we defined on it.


Most form fields are INPUT tags. The TYPE attribute defines the type of data it will provide. The VALUE attribute populates the html field with data.

3. Form fields

3.1 Text

This field type allows for text to be collected via forms.

<FORM METHOD="POST" ACTION="script.cgi">
Your name <INPUT TYPE="text" NAME="name"><BR>
<INPUT TYPE="submit" VALUE="Send Information">
</FORM>



The INPUT tag is defined to be of the 'text' TYPE. The NAME attribute will tell the program receiving the data from the form how to find this specific html field.

This creates a form where plain text can be entered.

Your name

3.2 Checkbox

This html field type allows for one or more options to be selected in online forms.

<FORM METHOD="POST" ACTION="script.cgi">
Colors you like<BR>
<INPUT TYPE="checkbox" NAME="color1" VALUE="Red"> Red<BR>
<INPUT TYPE="checkbox" NAME="color2" VALUE="Green"> Green<BR>
<INPUT TYPE="checkbox" NAME="color3" VALUE="Blue"> Blue<BR>
<INPUT TYPE="submit" VALUE="Send Information">
</FORM>



3.3 Radio buttons

This field type allows for only of of many options to be selected in html forms.

<FORM METHOD="POST" ACTION="script.cgi">
Your favorite color<BR>
<INPUT TYPE="radio" NAME="color1" VALUE="Red"> Red<BR>
<INPUT TYPE="radio" NAME="color2" VALUE="Green"> Green<BR>
<INPUT TYPE="radio" NAME="color3" VALUE="Blue"> Blue<BR>
<INPUT TYPE="submit" VALUE="Send Information">
</FORM>



3.4 Drop down menus


<FORM METHOD="POST" ACTION="script.cgi">
Your favorite color<BR>
<SELECT NAME="color">
<OPTION VALUE="Red"> Red<BR>
<OPTION VALUE="Green"> Green<BR>
<OPTION VALUE="Blue"> Blue<BR>
</SELECT>
<INPUT TYPE="submit" VALUE="Send Information">
</FORM>


3.5 Multiple lines of text


<FORM METHOD="POST" ACTION="script.cgi">
Your address<BR>
<TEXTAREA NAME="address">
</TEXTAREA>
<INPUT TYPE="submit" VALUE="Send Information">
</FORM>


Your address


4. Practical use of forms

The many html form fields can be combined in a single form to make it useful.

Additional attributes can be defined for the html tags used here. The goal of this tutorial/guide is to provide a place for beginners to find help and get started


The End


* This Tutorial is made by Promethian all credits is reserved *
Reply With Quote

Donate to remove ads.
(#2)
Old
gmking's Avatar
gmking is Offline
Sergeant
Rep Power: 2
Reputation: 7
gmking is an unknown quantity at this point
 
Posts: 67
Join Date: Sep 2007
08-31-2008

Nice guide! + rep


Reply With Quote
(#3)
Old
Promthian is Offline
Site n00b.. (A leecher if I've been here for more than a month and can't earn 5 rep)
Rep Power: 1
Reputation: 2
Promthian is an unknown quantity at this point
 
Posts: 5
Join Date: Aug 2008
09-03-2008

Thanks mate
Reply With Quote
(#4)
Old
Dark Soul's Avatar
Dark Soul is Offline
Contributor
Rep Power: 1
Reputation: 117
Dark Soul will become famous soon enoughDark Soul will become famous soon enough
 
Posts: 766
Join Date: Dec 2007
Location: AscentOS Dev PC
09-04-2008

Looks familier?
[Only registered and activated users can see links. ]
[Only registered and activated users can see links. ]
Btw, not even a PHP guide... More of an a HTML guide. :P



PHP Coder, Contact me via PMs if you need a Script made
Reply With Quote
(#5)
Old
Le Froid's Avatar
Le Froid is Offline
Contributor
Rep Power: 3
Reputation: 154
Le Froid has a spectacular aura aboutLe Froid has a spectacular aura about
 
Posts: 1,242
Join Date: Mar 2007
Location: /b/
09-07-2008

How is this a php guide?
Code:
<?

echo 'Does not compute';

?> 


"I don't fail at stuff, I succeed at finding what doesn't work"

Last edited by Le Froid; 09-07-2008 at 04:00 PM..
Reply With Quote
(#6)
Old
Tanax's Avatar
Tanax is Offline
Knight
Rep Power: 2
Reputation: 51
Tanax will become famous soon enough
 
Posts: 218
Join Date: Jan 2007
Location: Sweden
09-08-2008

I don't quite understand how this could be called a PHP guide.
Also, is this like.. really old or what? You never use <br> anymore.. you use <br />.


Reply With Quote
(#7)
Old
Act Of Chuck Norris's Avatar
Act Of Chuck Norris is Offline
Master Sergeant
Rep Power: 2
Reputation: 20
Act Of Chuck Norris is on a distinguished road
 
Posts: 97
Join Date: May 2007
Location: Australia, Mate!
09-28-2008

Quote:
Originally Posted by Tanax View Post
I don't quite understand how this could be called a PHP guide.
Also, is this like.. really old or what? You never use <br> anymore.. you use <br />.
Well, i suppose you could use <br> but when XHTML becomes the norm your website fails


Reply With Quote
(#8)
Old
Dark Soul's Avatar
Dark Soul is Offline
Contributor
Rep Power: 1
Reputation: 117
Dark Soul will become famous soon enoughDark Soul will become famous soon enough
 
Posts: 766
Join Date: Dec 2007
Location: AscentOS Dev PC
09-28-2008

XHTML is better than classic HTML.
Reason is: instead of <img src="fdfdf.gif"></img>
You can simply use <img src="obama_bin_ladin.jpg" />



PHP Coder, Contact me via PMs if you need a Script made
Reply With Quote
(#9)
Old
suicidity's Avatar
suicidity is Offline
Contributor
Rep Power: 3
Reputation: 90
suicidity will become famous soon enough
 
Posts: 713
Join Date: Oct 2006
Location: In your attic.
09-28-2008

Do not use caps in tags, very bad practice.

@ Le Froid - That wouldn't work, you didn't declare php properly.

<?php
echo 'Does not compute';
?>

Would work though.


Reply With Quote
Reply

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 Off
Pingbacks are Off
Refbacks are On



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361