Hello,
I started to program some php to make a web site with a database
To do so you need to install 2 programs.
For apache server and my sql server:
wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b
To edit your mysql tables:
SQLyog-11.5.1-0.x64Community
Also, the web server will not start if SKYPE is open and use port 80
(or anything that use port 80 for that matter)
Installing WAMP will create in your C drive a folder like this: C:\wamp
Inside it, a web folder: C:\wamp\www
index.php is the starting file for the server
You should add a sub folder for a project you make like this:
C:\wamp\www\project02
Then in this folder create a index.php file with notepad2 (for the colors)
Inside index.php you can have a HTML part:
------------------------- index.php file start ----------------------------
<!DOCTYPE html>
<html:html>
<html:body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><div align="center">
<title>my web site</title>
</head>
</html:body>
</html:html>
<html>
<body>
------------ comments start -------------
Now, since we are not newbs, we want to use inner html to build our page dynamically
So we insert a DIV zone called "zoneright"
Then a java script that will use inner html to update the content of that zone
Then a OD_flush et and flush to refresh the content (empty any buffer that was sent to your browser and apply change) without reloading the page
------------ comments end -------------
<?php
// $h is a variable to put html content
$h= "Nice web page that update dynamically";
// create a DIV zone with a name to use innrehtml later
$h.="<div id='zoneright'></div>";
// push the html content in the browser
echo $h;
// dynamic data to insert into the inner html zone "zoneright"
$h2 = "test 44";
// send a java script to the browser that will update the innerhtml zone for us
// syntax tip: before $h2 is a double quote " then a single quote '
// syntax tip: after $h2 is a single quote ' then a double quote "
echo '<script type="text/javascript">
document.getElementById("zoneright").innerHTML = "'.$h2.'";
</script>';
// empty all browser buffers to update the web page right now
ob_flush();
flush();
// wait 2 sec
sleep (2);
// new content
$h2 = "test 45";
// send another script to change inner html content for the new data in $h2
echo '<script type="text/javascript">
document.getElementById("zoneright").innerHTML = "'.$h2.'";
</script>';
// force brower to update right now again
ob_flush();
flush();
?>
-------------------- index.php file end ---------------------------
Now, save the index.php file
And load the local web site in your browser
http://localhost/project02
Now you learned to do some php, innerhtml and force a refresh on a page
Next, we will learn to use buttons to update the page content
I am newbie of this PHP technology, this post helps me to know the introductory of PHP, Thanks for posting such a nice post.
ReplyDeleteRegards,
PHP Training Center in Chennai|PHP Course Chennai
I love the blog. Great post. It is very true, people must learn how to learn before they can learn. lol i know it sounds funny but its very true. . .
ReplyDeleteData Science course in Indira nagar
Data Science course in marathahalli
Data Science Interview questions and answers
Data science training in tambaram
Data Science course in btm layout
Data science course in kalyan nagar
The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
ReplyDeleteBest Devops Training in pune
Devops Training in Bangalore
Microsoft azure training in Bangalore
Power bi training in Chennai
You are doing a great job. I would like to appreciate your work
ReplyDeleteRegards,
PHP Training in Chennai | PHP Course in Chennai | PHP Training Institute in Chennai
I have express a few of the articles on your website now, and I really like your style of blogging. I added it to my favourite’s blog site list and will be checking back soon…
ReplyDeletehardware and networking training in chennai
hardware and networking training in annanagar
xamarin training in chennai
xamarin training in annanagar
ios training in chennai
ios training in annanagar
iot training in chennai
iot training in annanagar
The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
ReplyDeletehardware and networking training in chennai
hardware and networking training in omr
xamarin training in chennai
xamarin training in omr
ios training in chennai
ios training in omr
iot training in chennai
iot training in omr
This programm really helps in gaining some knowledge to improve our ideas or thoughts , i really love this blog.And its really useful.
ReplyDeleteweb designing training in chennai
web designing training in tambaram
digital marketing training in chennai