Reditecting pages based on logic


Posted on 16th Feb 2014 07:03 pm by admin

Newbie here, apologies in advance!

I am trying to use the header function to forward one of any number of locations (taken from a db) based on the value of a response param:

Did you know?Explore Trending and Topic pages for more stories like this.
Quote<?php include '../include/db/db-open.php'; ?>
<?php
$postTypeId = $_POST['postTypeId'];
$postTypesResults = $mysqli->query("select id, editPageUrl from post_types where active = 1");
?>
<?php include '../include/db/db-close.php'; ?>
<?php
while ($postTypesResult = $postTypesResults->fetch_object()) {
if ($postTypesResult->id == $postTypeId) {
header("Location: ".$postTypesResult->editPageUrl);
}
}
?>

The value of $postTypeId is always blank if echoed (explining why the condition to forward is never met).

Two questions:
Is there anything obvious I am doing wrong causing $postTypeId to always be blank?Can the header function be used in this way?
Thanks
No comments posted yet

Your Answer:

Login to answer
191 Like 24 Dislike
Previous forums Next forums
Other forums

Help with ORDER BY
Hello. I would like to order by ascending States, then Cities, then Gyms in the following code, but

check if string contain only a-z/A-Z
Is where any way to check if string contains only a-z/A-Z, without writing an array with all possibl

What exactly is net neatrality?
What exactly is it? I think it's anti-censorship and... stuff... but I don't really understand it

form problem
Hi all, I think this is going to be easy to resolve but for I have been looking at it to long and I

Can I call a class inside a function?
I have a class written in another file that handles my image resizing.

Can I do this (php say

SAP Business Suite
Hi all:

Within the SAP Business Suite solution I would like to ask you the main differenc

Operating System
How in PHP or other language can I detect Operating system, ie Windows XP Home, Windows 7 Ultimate,

Sending UDP Raw socket
I truly need help on this. I am trying to write a test program that simulate a network environment

remove a ; from emails in textarea
Code: <?php

session_start();

$database_host = "localhost&qu

ClientScript.RegisterClientScriptBlock Issue
This is what I haveview plaincopy to clipboardprint?Protected Sub posrback_Click(ByVal sender As Obj

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash