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 forum quoting?
Hi im working on a forum and I have alomost finished it but i want a user quote system like twitter

Concatenate two strings ???
I have string one $string1 and another $string2.

How to concatenate (add) both of them $str

Count
Getting the same count everytime

Code:
$visitquery = mysql_query("SELECT COUNT(*) FR

need help modifying script
Hi guys,

I'm fairly new to php and am having a bit of trouble modifying a script.

This

Need help with cin setw
I made a program here is my code:

#include
#include
#i

keeps going back to index.html ???????
ok so i started making my site using mostly.html files now i have added a fair chunk of php. My inde

Change snippet to use CURDATE
I am using time() in the snippet below, I would like to use CURDATE() and have the database setup fo

Code working in IE but not FireFox
I created a dynamic navigation list for my website based off of a table in my database. The code is

Polymorphism
Was wondering if someone could explain this a little better to me. I had always assumed that it had

Comment Mod System Effects all rows...
Sorry if its confusing but here is whats going on: I have a table in a database called comments and

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