php - $_SERVER["PHP_SELF"] not working -


   <?php   $fname = $_post["fname"];   $lname = $_post["lname"];   echo "hello, ".$fname." ".$lname.".<br />";   ?>   <html>   <head>   <title>personal info</title>   </head>   <body>   <form method="post" action="">   first name:<input type="text" size="12" maxlength="12" name="fname"><br />   last name:<input type="text" size="12" maxlength="36" name="lname"><br />   <input type="submit">   </form>   </body>   </html> 

why doesn't code work? using wampserver. have tried alternative ""<form method="post" action="<?php echo htmlspecialchars($_server["php_self"]);?>">"" , put php code inside yet getting error webpage not found.

if leave action="" considers self page submission. can remove <?php echo htmlspecialchars($_server["php_self"]);?> , try below code.

<?php if(isset($_post['submit'])){   $fname = $_post["fname"];   $lname = $_post["lname"];   echo "hello, ".$fname." ".$lname."<br />"; }   ?> 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

How do you convert a timestamp into a datetime in python with the correct timezone? -