Showing posts with label php code. Show all posts
Showing posts with label php code. Show all posts

Thursday, 13 February 2014

Embedding PHP Inside HTML

Embedding PHP Inside HTML
Embedding PHP Inside HTML
This is a tutorial i am going to talking about embedding PHP Inside HTML. Now embedding is paying something within something embedding insides. lets see example

Code for simple html form with php file extension (screenshot1):-


Code For Simple Html From With Php File Extension Screenshot1
<input type="text" value=" Hello World.">

output (Screenshot2) :-

Embedding PHP Inside HTML
Screenshot2
you will see a small text-box with echo hello world. Now in another example i will embedding php code with html by using variables of php and in values of html form i will use standard variable for string lets see how it will happens

Code for embedding PHP Inside Html (Screenshot3):-

Code for embedding PHP Inside Html
                         Code for embedding PHP Inside Html Screenshot3


<?php
$text = 'Hello World.';
?>
<input type="text" value="<?php echo $text; ?>">

Output (Screenshot4):-


Embedding PHP Inside HTML
Screenshot4
In Advance php you have to use dynamic forms and so its good example for start-up  now in this $text is the variable which is string Hello world. and in html code we had called $text which is string Hello world. its pretty easy. variables also use in database , static text etc. Its very useful in php. variables are declared with ($) sign. and at end use “;”. and when you write php code u can write in one line or multiple line there is same effects. for example

you can use this code also for same result (screenshot4) :-

<?php
$text = 'hello world.';
?>
<input type="text" value="<?php
echo $text;
?>
">
Read More

Wednesday, 12 February 2014

Output html using echo statement in php

Output html using echo statement in php
Output html using echo statement in php
Output html using echo statement in php Programming Languages. This is a tutorial i am going to show you how to echo html active page. so, we know how to echo output and now if we want to echo out some html data. Let i want to echo output input text for a form and it will be done outside php code lets see example.

Code for input data for form (Screenshots1) :-


input data for form
Input Data For Form Screenshot1
<input type="text" name="name">


output (Screenshot2) :-

Output Screenshot2
In example in this way we normally write html with php codes.But what if we want to write echo output result which we writes in text box. That text box code will be inside php codes lets see example.


Code for showing you Parse error (screenshot3) :-

parse error
Showing You Parse error

<?php
echo <input type = "text" name="name">";
?>


output (screenshot4) :- You will find Parse error

prase error
Output Screenshot4


Parse error: parse error,expecting “;” or “;” in C:\xampp\htdocs\series\echohtml\index.php on line 2. you will see this error because when we starts semi colon with less then greater sign after equal to sign its says its ends here so its expecting “;” there for that there are some standard resolution lets see example

Code for proper way to write html codes in php echo statement(screenshot5):-

Writing Html Codes in Php Echo Statement
Writing Html Codes in Php Echo Statement Screenshot5
<?php

echo "<input type='text' name='name'>";

?>



output (screenshot2) :-


Output html using echo statement in php
Screenshot2
There are also different ways to write this codes showing in screenshots for same result screenshot2

Output html using echo statement in php
Screenshot6
Output html using echo statement in php
Screenshot7
Screenshot6 and screenshot7 is the other ways to write for same result for screenshot2 well screenshot7 codes are slower then other ways of codes.
Read More

Sunday, 9 February 2014

Writing Your First php file

Writing Your First Php File
Writing Your First Php File

This is a tutorial for how to write your First php file. In this tutorial we will learn about basic of creating php file what extension we going to give it. How we gonna show inside of the file to ensure that our web-server deals with it correctly because php is important web-server package you may need to specify in apache to look out at php files. you can do this in your http.com file which we looked up when we setup out apache installation. Php is server-side so what ever you write in between php tags would be not able to shown by people usually When you create html tags





<html>
<head>
</head>
<body>
</body>
</html>

Its seems this way will in php code :-

<?php ?>

well we can also specify php code in this way

<? ?>  <?php ?>

codes in this way.


<?php
//every things we write will goes here
?>

You can also combine php and html in pages of webserver.

codes :-

<?php
//your stuff
?>
<html>
//html tags
</html>

<?php
?>

OR

<?
//like that
?>

But i will prefer

<?php
?>

I have made root directory in my localhost to save file localhost/series/firstfile when we will use this link to open our firstfile screenshot1.
Screenshot1

In apache if save file name index.php or index.html it takes as default file whenever we call root directory at localhost it will open index.php bydefault.
Now we create file file.php in series/firstfile it will show you in localhost see screenshot1. Now let see combine php tags and html tags in file and see output
file.php code :-

<?php
?>
<html>
</html>

In this file when we see output screenshot2 let's see output view page source by right click..

Screenshot2

Screenshot3 you can see people can see out html tags well php is server side language so can not be seen by people.php codes are interrupted by web-server. php is server-side scripting language. If we save file name index.php we can not see the page which is in Screenshot2 Index of/series/firstfile and the list of files in it.because by default index.php will open automatically.

Screenshot3
Let create index.php in that i am writing simple commands of php like echo , echo is to use for print anything in output of php file.

Index.php codes:-

<?php

echo 'Hello World.';

?>

Path : localhost/series/firstfile/

first php file
FirstFile
Now you see screenshot6 its similar to screenshot5 just path of screenshot5 is localhost/series/firstfile/ just root directory and in screenshot6 you can see file name index.php same. no need towrite file name because its by default take file in root directory.only index name is configured in apache any other name you should declare with root directory in browser.



Read More

What Is PHP Programming


what is PHP Programming? Firstly i will teach you what is PHP? Why should you use it? Php code is internally interpreted by the web-server and it compiles on the server side. The source code of the applications is visible only in the html language so, no one is able to copy the php code. Therefore php codes can’t be hacked easily. Basically, it is used to prepare dynamic content on websites. There are PHP official website which are php . You can get more information by following this site. Now lets take a brief overview here.


What is php programming
What is Php Programming
Go over to php , you can get information about php as well as latest news. So, we get description about what is php? The great thing of php is it provides extensive documentation through which we can easily understand. From these site, you can download the documentation and functions which you search for. It describes information about functions, different types of arguments with proper examples.


Why is Php Better Than Other Programming Languges
Why is Php Better Than Other Programming Languges
Some of the websites using php and why they use it?

Best example :- Facebook

Facebook
Facebook

The code for facebook has been written in php language only. It is the popular social – networking website having lots of data stored in their database. So, we combine php with the database system such as MySQL. In these tutorials, i have used MySQL for data management because it is one of the widely used and powerful database around us or we can say fastest database around. So, MySQL is appropriate to be used with php for storing and managing data. Facebook which is one of the social networking website takes advantage of php as a whole.
This is an overview of the php, so if you think to start following this tutorial that i have created, you can begin to start creating dynamic websites and also realize that php is easy. Little fundamentals of any object oriented programming inside php is more difficult because some people get to struggle with object oriented programming. So, we do have the object oriented programming functionality within php and its added in php version 5 in year 2004.

Let See How Php Works


How php Works
How Php Works


How php Works so from your pc or laptop you make a page request across the web and that arrives at data center some were which could be in UK it could be in Europe or It could be in america or in Asia some where It doesn't matter where it is because your request will be deliver there. The actual hardware software runs on it is called Web-server.  Actual Software the web-server works Apache web-server  is a software one of the most common the most common web-server. So, Apache intercept the web-server page it says ok you wanna page i will built it for you. Firstly  i  it retrieve html page or it can be called php page but the page will be combination of php and html programming language. So, It retrieve files from the file system. Apache had a php plugin and it uses the php plugin to replace code with results running the code. So, example would be Mysql database php code may retrieve list of summer's or list of summing event's example what ever data you had stored want to extract from the database by php plugin it will retrieve data and output you the results. So this is sort brief overview of how php works







Read More

About Me

Welcome to Extra Tutorials! My name is Mohammed and I am the 22 year writer, website developer, and photographer behind the blog. Thanks for visiting! Tutorials Jackpot… In addition to Developer, I love to develop websites and I love to write. Starting a php Blog was inevitable for me. What began as a simple way to share all of my Tutorials with friends and family has developed into my Part time job.

Mohammed Padela

WHAT IS PHP PROGRAMMING

WHAT IS PHP PROGRAMMING
WHAT IS PHP PROGRAMMING

Follow Us

Popular Posts

Designed ByBlogger Templates