Click here to Skip to main content
15,922,533 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi there, I want to passing data like firstname for example http://mywebsite.com/erick instead of using http://mywebsite.com/index.php?name=erick, and display the firstname on the page. Anyone know how to do that please I need help.

What I have tried:

<?php

if($_GET["name"]){

print $_GET["name"];

}
else{ print "Welcome, Guest"; }

?>
Posted
Updated 23-Sep-17 21:51pm
Comments
Richard MacCutchan 24-Sep-17 3:11am    
Yes, create a webpage named erick.html.

1 solution

PHP as-is can not handle such URL formats (MVC too uses a router to solve it), but there are MVC implementations for PHP - go and Google one for you...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900