473,320 Members | 1,828 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,320 software developers and data experts.

Redirect to html page

Hi ,
Firstly I am new to this a forum and a big time beginner at php.
My Question is I am needing to create a search function on the homepage and this search function will direct the user to another page depending on what they enter in
the search area... eg. if they enter 100000 on the home page being www.blahbla.com - this will take them to the page www.blahbla.com/100000.htm ..

anyway ideas?
Thanks
Melissa
Jul 21 '06 #1
3 2973
ronverdonk
4,258 Expert 4TB
Are you looking for a real search function, as in searching for text embedded in files or data base, or just a link-creator?

Ronald :cool:
Jul 21 '06 #2
I suppose I am looking for a link-creator , if however they type in an invalid number it must be redirected to another page stating that...make sense?
Melissa :)
Jul 21 '06 #3
ronverdonk
4,258 Expert 4TB
I have a little piece of code.
index.php is the main, page1000.php and page2000.php are the existing pages, doesnotexist.php catches the non-existing page requests.
[PHP]
index.php:
<?php
if (isset($_POST['pageno'])) {
if (file_exists('page'.$_POST['pageno'].'.php')) {
header('Location: page'.$_POST['pageno'].'.php');
}
else {
header('Location: doesnotexist.php');
}
}
?>
<html>
<body>
<form action="index.php" method="post">
Enter the requested page <input type="text" name="pageno"/><br/>
<input type="submit" value="Request page">
</form>
</html></body>

page1000.php and page2000.php:
<?php
echo '<h3>You have reached page1000</h3>
<a href="index.php">Click here</a> to go back to our main page.';
?>
<?php
echo '<h3>You have reached page2000</h3>
<a href="index.php">Click here</a> to go back to our main page.';
?>
doesnotexist.php:
<?php
echo '<h3>This page does not exist our our system. Please retry.</h3>
<a href="index.php">Click here</a> to go back to our main page.'
?>
[/PHP]

Hope it helps.

Ronald :cool:
Jul 21 '06 #4

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

Similar topics

10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
3
by: Sean Berry | last post by:
Hi there. I am relativly new to Python CGI and need a question answered. I have made custom 404 error pages and have them in various web directories. I have not been able to figure out a way...
3
by: shank | last post by:
I have the following code to redirect users to http://www.mydomain.com/new/default.asp if they use the URL www.newstuff.com (sample). I have that domain name parked on www.mydomain.com. I'm getting...
8
by: Don Miller | last post by:
I have an ASP script that is called from a PDF form to process form data. On the last line of the script I have a Response.Redirect "webpage.asp" that leads to another target page with actual HTML....
2
by: Hymer | last post by:
Hello, I have a page that was redirected to the same page with a new URL a few years ago. I now want to assign a new URL and redirect to the new page. The first redirect is: Redirect...
12
by: gigi | last post by:
How to send more than one value using response redirect? For example i can send one like this response.Redirect "pregled.asp?ime=" & strUserName but how to send two or more values? I tried...
5
by: Kevin Audleman | last post by:
I understand how to use the header command to redirect a page before any HTML has been loaded.However, I need to redirect after some HTML has already been loaded. is there a command that will...
56
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my...
8
by: Darrel | last post by:
I'm helping convert a 300+ page .html site into an ASP.net site. The client wants to set up 301 redirects for all of the old html pages. I've used ISAPI for this type of thing in the past, as it...
7
by: seanmatthewwalsh | last post by:
Hi I have a page (default.aspx) that pulls it's HTML from a database. I then have a "content management" page (editpage.aspx) that allows the user to edit the HTML in the database. When the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.