Today, I learned about the URL Redirection in PHP. Manual redirect The simpest technique is to ask the visitor to follow a link to the new page, usually using an HTML anchor like: Please follow this link Using server-side scripting for redirection One can use the "header" function: header("HTTP/1.1 301 Moved Permanetly"); header("Location: https://www.example.com/"); exit(); Header() Example:
Today, I learned about the Session and header. Session A Session starts when you launch a website or web app and ends when you leave the website or close your browser window. Session allows you to maintain state information even when cllients disable cookies in their Web browsers. Session cookies contain information that is stored in a temporary memony location Session is known as transient cook..
I made login and sign up page using PHP and MySQL. I skip the entire html code this time. Here is the method to pass the data to php files. Let's take a look at Sign up system first. Sign up I checked the email and password confirm first. For connecting this php file to our database we use the code: require_once("config.php"); So, we call the config.php for connecting current php file to databas..
This is the exercise to make a simple number guess game. So, I get the number from html. using $_GET["guess"]. Put the value in $guess. strlen() checks whether user put the number or not. is_numeric() checks whether it is number or not. I set the random number is 55 in this time.
In this exercise, we are gonna make a bill. First, we should get the values from the HTML file. If we get the values with POST, it would be like this. We can make the case if the quantity is 0. Now, we are gonna make the bill in php file. We learned that how to use values from HTML in php file!
This is how PHP form works! $_GET array $_POST array In PHP, we can handle our data like this method. We can access to the data with this method. This is the validation of PHP.
PHP function can be defined like this. Also, we should know how to set parameters in PHP function. Here is the variable scope within funcitons. Array This is how defining and accesing an Array in PHP. This is how to use loop with PHP Array. isset() function Takes a variable name as its parameter Return true if a value has been set Return false otherwise Now, I wand to share the in-class activity..
PHP code can be embeded directly within an HTML file. A PHP file will usually have the extension .php. Comment: Multi-line block comments /* */ Single-line comments // or # PHP Tag Example Include PHP files PHP $Variables and Data Types Variables in PHP are dynamically typed. The PHP engine makes a best guess as to the intended type based on what it is being assigned. A variable can be assigned ..
We are gonna learn about how to setup PHP on our desktop/laptop. Go Website: www.mamp.info Select right version to your computer Download files and launch it. Click the application: Now, we can start the hosting by clicking "WebStart." localhost is the default name of the computer, 127.0.0.1 is the IP address of the local computer. Place the .php(php files) to under the htdocs folder. However, i..