|
Posted by Kevin Raleigh on 05/28/07 05:42
using the following code produces the following error
> <?php
> header("location: $_POST['location']");
> exit;
> ?>
Error in my_thread_global_end(): 1 threads didn't exit PHP Parse error:
syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or
T_VARIABLE or T_NUM_STRING in
C:\Inetpub\wwwroot\phpBasics4.0\do_redirect.php on line 17
My "Guess" is that it will only take a string, variable, or number as an
argument.
So I tried this:
<?php
$id = $_POST[ 'id'];
if($id=="MSN") {
$location = "http://www.msn.com/";
} else if ($id == "php"){
$location = "gttp://www.php.net/";
} else if ($id == "slashdot") {
$location = "http://www.slashdot.org/";
}else if ($id == "linuxchix") {
$location = "http://www.linuxchix.org/";
}
header("location: 'location'");
exit;
?>
This gives me a 404 file not found error
So I tried this:
<?php
$id = $_POST[ 'id'];
echo ("$id");
?>
From this:
<form method="post" action="do_redirect.php">
<select name="id" size=1>
<option value="http://www.msn.com/">MSN</option>
<option value="http://www.php.net/">Php.net</option>
<option value="http://www.slashdot.org/">Slashdot</option>
<option value="http://www.linuxchix.org/">Linuxchix</option>
</select> <input type="submit" value="Go">
</form>
And have this error:
http://www.php.net/ Error in my_thread_global_end(): 1 threads didn't exit
I am guessing that my thread doesn't exist, but why?
Must be missing something extremely trivial
Thank You
Kevin
"peter" <submit@flexiwebhost.com> wrote in message
news:f3afnt$d7q$1@aioe.org...
>
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> >
> > <html><body>
> >
> > <form method="post" action="do_redirect.php">
> > <p>I want to go to:</p>
> > <select name="location" size=1>
> > <option value="http://www.msn.com/">MSN</option>
> > <option value="http://www.linuxchix.org/">Linuxchix</option>
> > </select>
> >
> > <input type="submit" value="Go">
> > </form></body></html>
> >
> > send it to this page
> >
> > <?php
> > header("location: $location");
> > exit;
> >
> > ?>
> >
> > I get this error:
> > HTTP Error 403 - Forbidden
> > Internet Explorer
> >
> > However, when I hard code it, I have no problem
> > <?php
> > header("location: http://www.php.net");
> > exit;
> >
> > ?>
> >
>
> It should be :-
>
> <?php
> header("location: $_POST['location']");
> exit;
> ?>
>
> BUT you should double check that $_POST is a valid option that was
selected.
>
>
Navigation:
[Reply to this message]
|