Redirect
Moderator: General Moderators
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
Yes use the header function (as shown below) but notice this will only work if you have not output any headers already (which could be anything from a space in your file to an echo statement, etc). Basically this will only work if no other output has already been sent to the browser.
Code: Select all
<?
Header('Location: http://www.site.com/page.html');
exit;
?>-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
Initially I read a text file into an array:-
Then i have a form to read in the works order number.
Now i simply check the array for the worksord and if it is recognized i want to redirect to another page.
At what stage am i outputting headers??
Thanks
Dave
feyd | use
Code: Select all
<?php
$file = implode("",file("Eng_Internet_query.txt"));
preg_match_all('/^(.*?),"(.*?)","(.*?)","(.*?)","(.*?)","(.*?)","(.*?)","(.*?)","(.*?)","(.*?)","(.*?)","(.*?)","(.*?)"/ms',$file,$matches);
$worksord = $_POSTї'worksord'];
?>Code: Select all
<div align="center">
<form action="<?php print $PHP_SELF?>">
<input type="text" name="worksord">
<input type="submit" value="Submit!">
</form>
</div>Code: Select all
<?php
if (in_array($worksord,$matches[3])){
Header("Location: http://www.website.com");
}else
{
print "Works Order number not found.";
}
?>Thanks
Dave
feyd | use
Code: Select all
andCode: Select all
tags next time. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
Code: Select all
<?php
ob_start();
?>