Mikky
Mikky

Reputation: 101

something is wrong with my header(Location)

I am very confused with this. I have a button which use JavaScript onClick. It should redirect to another page but it doesn't. It instead downloads the file.

Edit this is all the code

    <?php 
$getGoogleData="SELECT * FROM markers WHERE propid=$propID";
$QgetGoogleData=$db->query($getGoogleData)or die($db->error);
    if($QgetGoogleData->num_rows==1){?>
    <p style="color:#27AB00; font-size:16px; font-weight:bold;">There is already Map for this project, you can't edit it but you can reamove it and make a new one<br /><br /><input type="button" onClick="javascript:window.location.href='index.php?cid=9&proid=12&propId=<?php echo $propID?>'" value="Delete Current Map"></p>
    <?php }else{?>
    <p style="color:#CD0000; font-size:16px; font-weight:bold;">There are no Map for this project please make one<br /><br /><input type="button" onClick="javascript:window.location.href='index.php?cid=9&proid=11&p=<?php echo $propID?>'" value="Make Your Map"></p>
    <?php }?>

on the other page proid=11

case 11: header('Location:includes/pan/projects/google/face.php?p='.$p); break;

I found what is wrong but still this will not solve the problem. I have this file in the same directory .htaccess which content this code.

AddType application/x-httpd-php .js

AddHandler x-httpd-php5 .js

<FilesMatch "\.(js|php)$">
SetHandler application/x-httpd-php
</FilesMatch>

and I put this file because I have some php code witch will not work with the Js. without this file any help please.

Upvotes: 0

Views: 125

Answers (1)

Quentin
Quentin

Reputation: 943214

If it downloads the PHP file then the odds are that the PHP is not being executed.

PHP is (in this context) a server side language, it needs to run through a webserver. The most likely reasons for this not to work are:

  • You have no webserver
  • You have not installed PHP support on the webserver
  • You are running a webserver but are telling the browser to load the files with a file:// URI instead of an http:// URI so it isn't being used

Upvotes: 4

Related Questions