php to html page redirection after performing a db insert query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • npdv2009
    New Member
    • Jul 2015
    • 4

    php to html page redirection after performing a db insert query

    My php script performs a insert query ,
    Then i want it to go to another html page.
    header('Locatio n : <url>') not working.
    I an working on wamp server.
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    The problem is lines 24 thru 30. Delete them and all will be well. ;)

    If you want serious answers, you'll need to post your code and explain what you mean by "not working". Do you receive any error message? Does it redirect to the somewhere else? Does it cause your computer to catch on fire?

    Comment

    • npdv2009
      New Member
      • Jul 2015
      • 4

      #3
      My code:
      Code:
      <?php 
      $con = new mysqli("localhost:3306","root","","parking");
      if($con->connect_error){
      die("connectionn failed".$con->connect_error);
      }
      $url='localhost/4 user hame page.html';
      $nam=$_REQUEST["name"];
      $ag=$_REQUEST["age"];
      
      $pho=$_REQUEST["phonenumber"];
      $mai=$_REQUEST["mailid"];
      $uname=$_REQUEST["Username"];
      $pwd=$_REQUEST["password"];
      
      
      $con->query("INSERT INTO `user` (`name`, `age`, `gender`, `phone`, `mailid`, `uname`, `pwd`) VALUES ('$nam', '$ag', 'f', '$pho', '$mai', '$uname', '$pwd')");
      
      
      header("Loaction: localhost/4 user home page.html/");
      
      ?>
      not working in the sense nothing happens, i.e no redirection or error.
      Last edited by Rabbit; Jul 31 '15, 03:57 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.

      Comment

      • RonB
        Recognized Expert Contributor
        • Jun 2009
        • 589

        #4
        Do you have error reporting enabled?

        Do you get a blank page, or something else?

        Are you using the full URL in the redirect, or a relative path? If it's a relative path, you should change it to the full URL.

        Comment

        • npdv2009
          New Member
          • Jul 2015
          • 4

          #5
          blank page only.
          it's the full url

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Please use code tags when posting code or formatted data.

            Does it insert the data?

            Your problem is line 19. You spelled Location wrong.

            Also, your other problem is line 19. Unless the client is viewing this page from the same computer that the web server is on, the client computer can't resolve the localhost reference.

            Comment

            • npdv2009
              New Member
              • Jul 2015
              • 4

              #7
              Thanks got it , after the spelling correction .

              Comment

              Working...