Difference between revisions of "PHP-and-MySQL/C2/Embedding-PHP/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 4: Line 4:
 
|-
 
|-
 
|00:00
 
|00:00
|This is a short tutorial on how to embed Php code inside HTML code.  This is very useful in many situations.
+
|This is a short tutorial on how to embed '''Php code''' inside HTML code.  This is very useful in many situations.
 
|-
 
|-
 
|00:14
 
|00:14
Line 22: Line 22:
 
|-
 
|-
 
|00:52
 
|00:52
|I will start a '''Php''' and a '''tag''' here. I '''echo''' out "Alex" and then come in outside the '''Php tags''' and add my '''bold''' here and my '''bold end''' after the ending '''Php tag'''.
+
|I will start a '''Php''' and a '''tag''' here. I '''echo''' out "Alex" and then coming outside the '''Php tags''' and add my '''bold'''(<b>) here and my '''bold end'''(</b>) after the ending '''Php tag'''.
 
|-
 
|-
 
|01:13
 
|01:13
Line 28: Line 28:
 
|-
 
|-
 
|01:20
 
|01:20
|So, we can change that to underline and you can see that "Alex" is underlined.
+
|So, we can change that to '''underline'''(<u>) and you can see that "Alex" is underlined.
 
|-
 
|-
 
|01:26
 
|01:26
Line 37: Line 37:
 
|-
 
|-
 
|01:48
 
|01:48
|So, let's say text and the name of this will be '''name''' and the value is going to be equal to "Alex".
+
|So, let's say 'text' and the '''name''' of this will be 'name' and the '''value''' is going to be equal to 'Alex'.
 
|-
 
|-
 
|01:56
 
|01:56
Line 46: Line 46:
 
|-
 
|-
 
|02:30
 
|02:30
|If you haven't seen the '''get''' tutorial already, make sure you watch that.
+
|If you haven't seen the '''GET''' tutorial already, make sure you watch that.
 
|-
 
|-
 
|02:38
 
|02:38
Line 67: Line 67:
 
|-
 
|-
 
|03:35
 
|03:35
|So, we're using '''Php code''' inside our value here.
+
|So, we're using '''Php code''' inside our '''value''' here.
 
|-
 
|-
 
|03:40
 
|03:40
|I'm going to demonstrate dollar ($) underscore (_) '''get''', remember using the single quotes.
+
|I'm going to demonstrate dollar ($) underscore (_) '''GET''', remember using the single quotes.
 
|-
 
|-
 
|03:50
 
|03:50
|I'm going to say '''name''' and then '''refresh'''.
+
|I'm going to say 'name' and then '''refresh'''.
 
|-
 
|-
 
|03:55
 
|03:55
|Nothing's happened; so type in '''name=Alex''' which gives us "Alex" inside that.
+
|Nothing has happened; so type in '''name=alex''' which gives us "alex" inside that.
 
|-
 
|-
 
|04:04
 
|04:04
|Type in '''name=Kyle'''. It gives us "Kyle" inside that.
+
|Type in '''name=kyle'''. It gives us "kyle" inside that.
 
|-
 
|-
 
|04:11
 
|04:11
Line 85: Line 85:
 
|-
 
|-
 
|04:16
 
|04:16
|Try saying '''echo Php info''' and you'd get a very funny result.
+
|Try saying '''echo Php info()''' and you'd get a very funny result.
 
|-
 
|-
 
|04:28
 
|04:28
|This is the HTML code of Php info document.
+
|This is the HTML code of '''Php info''' document.
 
|-
 
|-
 
|04:33
 
|04:33
Line 94: Line 94:
 
|-
 
|-
 
|04:37
 
|04:37
| Here we're just working with Php inside.The only thing you need to worry about is being careful with your single and double quotes.
+
| Here we're just working with '''Php''' inside. The only thing you need to worry about is being careful with your single and double quotes.
 
|-
 
|-
 
|04:46
 
|04:46
|So this was the basic tutorial on embedding Php code inside HTML code.
+
|So this was the basic tutorial on '''embedding Php code''' inside '''HTML code'''.
 
|-
 
|-
 
|04:53
 
|04:53

Revision as of 16:46, 26 May 2015

Time Narration
00:00 This is a short tutorial on how to embed Php code inside HTML code. This is very useful in many situations.
00:14 For example, if I were to create Php tags and echo out my name here.
00:23 By running this, let's click on a file, we just get "Alex".
00:30 Now for example, I can embed HTML inside this and echo it out here to make "Alex" a little bolder.
00:38 But what I can do is I can switch this the other way round.
00:45 Let's start again, create an HTML page. I'm going to use this example.
00:52 I will start a Php and a tag here. I echo out "Alex" and then coming outside the Php tags and add my bold() here and my bold end() after the ending Php tag.
01:13 And it gives us the same result, nothing has changed even though I've refreshed the page.
01:20 So, we can change that to underline() and you can see that "Alex" is underlined.
01:26 So, we can do it either ways. It's up to you to use the HTML code inside the echo or not. But there are more uses to this.
01:39 Now, if you do know HTML, you know the input tag is a template tag.
01:48 So, let's say 'text' and the name of this will be 'name' and the value is going to be equal to 'Alex'.
01:56 Let's refresh this and we see we've got a text box here with "Alex" inside. Now I want to use Php to grab the get variable header and put it inside this value of our input value.
02:14 Now, this is really useful in some cases like form submission and error checking where you want the posted variables to stay inside the value of each text box.
02:30 If you haven't seen the GET tutorial already, make sure you watch that.
02:38 Now, bring this down a couple of lines, obviously we still run this code successfully because it works on similar line basis.
02:48 So, this you see here is exactly the same as that, you just have to force it down a bit and I'm going to create Php text here.
02:58 This is going to look a funny brown colour because we're working in Php highlighting and it's not really recognizing this type of highlighting.
03:08 Ok, I'm just going to echo out "Alex".
03:12 Since this works on a single line basis, bring this all up on a single line. So, now I have embedded this inside that and your embedding is done.
03:25 By refreshing we get the value of "Alex". We're echoing out now Php inside an HTML value.
03:35 So, we're using Php code inside our value here.
03:40 I'm going to demonstrate dollar ($) underscore (_) GET, remember using the single quotes.
03:50 I'm going to say 'name' and then refresh.
03:55 Nothing has happened; so type in name=alex which gives us "alex" inside that.
04:04 Type in name=kyle. It gives us "kyle" inside that.
04:11 Basically you can embed any Php code you want inside that.
04:16 Try saying echo Php info() and you'd get a very funny result.
04:28 This is the HTML code of Php info document.
04:33 So, you can see that there's loads of code in that.
04:37 Here we're just working with Php inside. The only thing you need to worry about is being careful with your single and double quotes.
04:46 So this was the basic tutorial on embedding Php code inside HTML code.
04:53 I hope it was useful. Thanks for watching.
04:56 This is Anoushka, dubbing for the Spoken tutorials Project.

Contributors and Content Editors

Minal, PoojaMoolya, Pratik kamble, Sandhya.np14