1

How can I make GET requests to work if my website is built on includes?

for example in index.html I rely on <!--#include virtual="/includes/columns/col-2.shtml" --> to show the content.

And in col-2.shtml I got this simple script <?php $success = $_GET['success']; if($success == 1) { echo "User created!"; }?>

So when I browse to http://www.mysite.com/index.html?success=1 It doesn't display my echo. And yes .shtml is set to parse php in .htaccess.

Any ideas?

2
  • Hmm. Does the apache virtual process processed PHP actually when bound to .shtml?
    – hakre
    Aug 20, 2011 at 0:19
  • View source when you goto that page - you'll probably find your <?php tags are showing, but not being rendered by the browser!)
    – Mez
    Aug 20, 2011 at 0:28

2 Answers 2

4

You seem to be mixing your technologies here!!!

Rename index.html to index.php (or index.shtml), and change your include to be

<?php 
include('/includes/columns/col-2.shtml');
?>
3
  • 1
    @David Meyer: That's what testing servers are for.
    – animuson
    Aug 20, 2011 at 0:25
  • 2
    don't preview in dreamweaver.
    – user47322
    Aug 20, 2011 at 0:26
  • Unfortunately, that's a limitation of Dreamweaver! shtml includes are not meant to include PHP files. This is why something's going wrong (I'm presuming it not being parsed as PHP correctly) and it's not being passed the GET. It's your choice which is more important - the data getting through, or your Preview working :(
    – Mez
    Aug 20, 2011 at 0:27
0

Includes don't naturally send GET/POST info... You can try this:

<?
$_POST[username]="123456";
include("login.php");
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.