Re: Reposting elseif carry
| From: | Ronald \"The Newbie\" Allen | Date: | Sun, 16 May 2004 07:09:08 +0000 |
| Subject: | Re: Reposting elseif carry | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186342@lists.php.net to get a copy of this message | ||
While I am sure that you are right. I went to the webpages that you
identified and did not see anything on' and ". I tried the code that typed
up and it said that Date_and_Time wher and undefinded index and also that
the headers could not be modified.
Advanced stuff for me, while I do see the logic in the operation
What is the difference in a single quote and a double quote?
the base_url is this suppose to be an I or and L
$base_url .= dirname($_SERVER['REQUEST_UR I ']);
"Curt Zirzow" <php-general@zirzow.dyndns.org> wrote in message
news:20040516020314.GE38565@bagend.shire...
> * Thus wrote Ronald The Newbie Allen (sesel@omantel.net.om):
> >
> > what I currently have is
> >
> > echo "<META HTTP-EQUIV=\"refresh\" content=\"0;
> >
> > URL=./Conference_Calls.php?Date_and_Time=".$_POST["$Date_and_Time"].">";
>
> Have you looked at what this is actually outputing?
>
> >
> > Tried several things from the string and either they return a parsing
error
> > or they return ".$_POST
> >
> > kind of clueless now....help please
>
> You might want to read:
> http://www.php.net/manual/en/langref.php
>
> It'll give you a better grasp on what you're trying to do.
>
>
> >
> > The code:
> >
> > <?
> > $event = $_GET['Event_Type'];
> > $Date_and_Time = $_GET['Date_and_Time'];
>
> You're using $_GET here but $_POST in the output of your meta tag,
> which one is it?
>
> > //echo "$event";
> > //echo "$time";
> > if ($event == "Trouble_Tickets") {
> > echo '<META HTTP-EQUIV="refresh" content="0;
URL=./Trouble_Tickets.php">';
> > } elseif ($event == "Conference_Calls") {
> > print '<META HTTP-EQUIV="refresh" content="0;
> >
> > URL=./Conference_Calls.php?Date_and_Time=$_POST["Date_and_Time"]">';
> > } elseif ($event == "Outage_Reports") {
> > echo '<META HTTP-EQUIV="refresh" content="0;
URL=./Outage_Reports.php">';
> > } else {
> > echo '<META HTTP-EQUIV="refresh" content="0;
> > URL=./log.php">';
> > }
> >
>
> A few points:
> - You're if/elseif would better be written with a switch()
> statment.
> - You shouldn't really use a meta-refresh, but redirect the user
> using header().
> - Learn the difference between how php treats the single quote (')
> vs the double quote (")
>
>
> <?php // this start tag is highly recommended
>
> // Grab the event from the Query String
> $event = $_GET['Event_Type'];
>
>
> // Make the base url for redirection.
> $base_url = 'http://' .
> $_SERVER['HTTP_HOST'];
> $base_url .= dirname($_SERVER['REQUEST_URI']);
>
> switch ($event) {
>
> case 'Trouble_Tickets':
> $redirect = $base_url . $event . '.php';
> break;
>
> case 'Conference_Calls':
> $redirect = $base_url . $event . '.php?Date_and_Time='.
$_POST['Date_and_Time'];
> break;
>
> case 'Outage_Reports':
> $redirect = $base_url . $event . '.php';
> break;
>
> default:
> $redirect = $base_url . 'log.php';
> break;
> }
>
> // Now redirect the user
> header('Location: ' . $redirect);
> exit();
> ?>
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."