/    Sign up×
Community /Pin to ProfileBookmark

hi,

I have a script that does this :

[code=php]
if ($down==1){
$query4 = “UPDATE mainMenu SET positie=’$positionDOWN’ WHERE positie=$positionSTORE”;
$result4 = mysql_query($query4);
$down = 0;
}
[/code]

but at the and of the if statement it should refresh the page and I tried to do it with something like this:

[code=php]
<!–this one kept refreshing over and over again–>
echo “<script type=’text/javascript’>window.location.reload(true)</script>”;

<!–and i tried a return function and that only made my page gray–>
return ‘menu.php’;
[/code]

I searched the internet for an answer and found many of the same questions but not with the right answer. What can I do??

Thanks in advance

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYAug 19.2005 — if you have no output sent yet you can use the [code=php]header("Location: http://www.url.com/page.php");[/code]

and btw comments in php are in the following formats:
[code=php]//this line would be commented[/code]
or
[code=php]
#this line as well
[/code]

or you can use multiline comments
[code=php]
/* blahkakhdjash
jasdhsjkf
sjhdf*/[/code]
Copy linkTweet thisAlerts:
@zebdaagauthorAug 19.2005 — Thanks for the reply i will try it soon..

and i knew about the comments but i mix it up all the time!!
Copy linkTweet thisAlerts:
@aznchong91Aug 19.2005 — Yeah, you should use header(). Don't forget though that the header should come before ANY html or anything else except for PHP.
Copy linkTweet thisAlerts:
@zebdaagauthorAug 19.2005 — Hi it works but i get an error:

Warning: Cannot modify header information - headers already sent by (output started at /home/okparkin/public_html/CMS/restricted/menu.php:12) in /home/okparkin/public_html/CMS/restricted/menu.php on line 50

does this has to do something with the last post??
Yeah, you should use header(). Don't forget though that the header should come before ANY html or anything else except for PHP.[/QUOTE]
Cause i didn't really understood what it meant how can I put it before any thing??

greetz zeb
Copy linkTweet thisAlerts:
@aznchong91Aug 20.2005 — <?php

header(blah);

?>

<html>

<head>...
Copy linkTweet thisAlerts:
@aznchong91Aug 20.2005 — In fact, you could just add the php and forget about any html, css,javascript,etc. programming. You could also do this though:

<?php

//do some coding

header();

//because php can be added before the headers.
Copy linkTweet thisAlerts:
@zebdaagauthorAug 22.2005 — Tried all of it but still got this error..

don't know what to do


Warning: Cannot modify header information - headers already sent by (output started at /home/okparkin/public_html/CMS/restricted/menu.php:12) in /home/okparkin/public_html/CMS/restricted/menu.php on line 50
[/QUOTE]


greetz thanks in advance Zeb
Copy linkTweet thisAlerts:
@zebdaagauthorAug 22.2005 — Okay the error is away the problem was whitespaces on top and bottom of the page it's working now

thanks in advance
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYAug 23.2005 — oh yeah, always becareful about this whitespaces! ?
×

Success!

Help @zebdaag spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...