News:

The "Support Requests" forum is now viewable by guests.

Main Menu

PHP SAVY???? Ampersands not accepted in URLs

Started by doctoreast, July 22, 2007, 04:38:32 AM

Previous topic - Next topic

doctoreast

Can someone please tell me why this wont work:

THE PHP GETS ARE NOT WORKING, COMES UP WITHOUT CONTENT OR PAGE TITLE:

http://trymikey.com/includes/static1.php?title=MainPage&content=form_home-content-tm.php

If you CHANGE the & (valid html) to & (invalid html) it will work.

THE PHP GETS ARE WORKING, GETS CONTENT AND PAGE TITLE:

The php scripts which are used for the "get" functions for static pages
is:




<!-- STATIC SET THE PAGE TITLE -->
<?php
if($_GET['title']){  // CUSTOM GET TO SUPPRESS ERRORS: if Pt is in the URL //
$pgtitle $_GET['title']; //  Assign title=$pgtitle // 
print('<title>'.$pgtitle.': TryMikey.com</title>'); 
}
?>


</head>

<body>


<!-- YOUR CONTENT FOR THIS PAGE GOES HERE -->
<?php
if($_GET['content']){ // CUSTOM GET TO SUPPRESS ERRORS: if Pg is in the URL //
$pgcontent $_GET['content'];  //  Assign content=$pgname // 
                       // $pgcontent specifies the include filename 
print('<div>');
include(
'/fpgs/fpgshttpd/trymikey/trymikey/includes/'.$pgcontent);// Any File Name Inserted //
print('</div>');
}
?>



brainiac744

&amp; will only work if you put it in an <a href> or <img src> or some HTML tag, if you're just typing in the URL you need to leave amp; out because that is an HTML entity that the browser translates on the page for you.

fizznos

In GET requests, parameters passed in via the url are seperated by a single &.

So for example, if you have a page static1.php and you want to pass 2 parameters to it, for example:
title=MainPage
content=form_home-content-tm.php

To be correct, the request should look like this:
http://trymikey.com/includes/static1.php?title=MainPage&content=form_home-content-tm.php

Instead, you have:
http://trymikey.com/includes/static1.php?title=MainPage&amp;content=form_home-content-tm.php
which doesn't do what you expect.

doctoreast

Hi,
  I dont know what the problem was, but dreamweaver's
auto-formatting seems to have fixed the problem, valid html
and all works. 
Thanks,
doc