473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

header location in a div !

155 100+
i got some php code that sit in a div that is refreshing every 4 seconds
and checking some data from other file:

if {data is not ok } continue

if {data is ok } go to:

header:location to some url!!


my problem is that the redirecting is displaying the data in the div tag!!

what can i do so all the page will be changed to the header location?

thanx!!
Nov 3 '08 #1
5 3616
Markus
6,050 Expert 4TB
First of all, you can't have the header() function after you've output html - you should receive a fatal error.

Secondly, I'm not understanding the question.

Post the code you have tried.
Nov 3 '08 #2
canabatz
155 100+
this is the code!! i want that the all page will be displayed ,not in the div , this code is in a div that is called by ajax!

Expand|Select|Wrap|Line Numbers
  1. $query_102="select * from bidding_main where bid_id='$bid_id'";
  2.         $result_102=mysql_query($query_102);
  3.         $row_102=mysql_fetch_array($result_102);
  4.  
  5.         $sqlno="select * from bidding_details where bid_id=$bid_id";
  6.         $queryno=mysql_query($sqlno);
  7.         $numno=mysql_num_rows($queryno);
  8.  
  9.         $max_bid=$row_102['max_bid'];
  10.         $hbid=$max_bid-$numno;
  11.  
  12.         if($numno>=$max_bid && $dt>=$var_timestamp)
  13.         {
  14.         $sql_update1="update bidding_main set bid_status='close', end_date='$date' where bid_id='$bid_id'";
  15.         mysql_query($sql_update1)or die(mysql_error());
  16.  
  17.         $sql_update123="update bidding_details set bid_status='close' where bid_id='$bid_id'";
  18.         mysql_query($sql_update123)or die(mysql_error());
  19.  
  20.         header("Location:http://www.bonker.co.il/product_detailclose.php?bid_id=$bid_id");
  21.  
  22.         exit;
  23.         }
  24.         else {
  25.         // do nada
  26.         }
Nov 3 '08 #3
nathj
938 Expert 512MB
Any header information has the be the first output. This means that you can have server side code before it but if anything puts information to the browser it has to come after the header command.

Having read over your code I notice that you have whitespace. this is generally good practice but as far as headers are concerned it causes problems.

Check out the manual.

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file
So try removing the white space, you can have many lines, just no white space between them. If that doesn't help you out post back and I'll take another look.

However, if that's a code snippet and it's actually within a div as your question suggests and you need to have the page output in there then header is not the solution for you. I'm not sure but cURL may work, it's not something I've ever used myself.


Cheers
nathj
Nov 3 '08 #4
canabatz
155 100+
i forgot to say but the code is working ,the problem is that the code is executed in the div ,not in the parent link!!

my site is built like that

i got a div tag that is refreshing with ajax ,the ajax is calling other file and display it in the div ,i put this header code in it so it will do something when needed ,so when the time comes and the code need to be executed ,it is executed but instead of in the parent page ,it is executed in the div ,its working like it is in iframe!!

tthanx!
Nov 3 '08 #5
canabatz
155 100+
i fixed it!!

i made another file with meta refresh

and in my header:location i point it to the new file ,this is the only way i found to execute header from a div!!

the header:location is siting in a div!!!


i hope it will help some one else that looking for a fix!!
Nov 6 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Margaret MacDonald | last post by:
I'm seeing a problem that has me flummoxed. The only thing I can think of is that I'm violating some rule I don't know about. I have some code that does some processing and then does a...
6
by: John | last post by:
Hi. I am having a few header problems at the moment with a login page. I don't have my headers at the top of the page where I've learned I need to have them. However, I also know I'm supposed...
7
by: Monty | last post by:
Something odd is happening. Scripts on several sites that collect form data, save it to a DB, then redirect the user to another page are slowing to a crawl during the redirect using the header()...
6
by: G*rd*n | last post by:
I have been using the HTTP "Location" reponse header to direct a symbolic request to a CGI program to an actual URL/file. For example, let us suppose the CGI program's table indicates xyz ->...
23
by: lwoods | last post by:
I am trying to pass some info to another page on my site. I set "session_start()" in page 1, assign a session variable to a value, then execute a "header('Location: ....')." But on the target...
2
by: Ladbroke | last post by:
Hiya, got a little prob with the syntax for header ( ' Location .... with variable). Usually examples are given with a complete URL, like: ..... header( 'Location: login/testsite/start.php'...
6
by: P-Rage | last post by:
Hello everyone, I was wondering what could possibly cause Internet Explorer 6 to loop a page usging a header(Location:) statement. For example, a page called 'page1.php': if((isset($_POST))...
12
by: Jerim79 | last post by:
I have created a verification script to verify information and redirect the customer to the appropriate error page. For example: if ($FName=""){ header('Location:/verify_fname.htm'); } else{...
4
by: andre rodier | last post by:
Hello, I need to display or propose a jpeg image on a web page. When I need to display the image, I use this code : header("Content-Length: $fileSize") ; header("Content-Type: $type") ;...
4
by: Call Me Tom | last post by:
I was looking at an application with the following code snippet: ob_start(); session_name('foo'); session_start(); if (!$_SESSION) { header("Location: http://" . $_SERVER . dirname($_SERVER)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.