Forum Moderators: coopster

Message Too Old, No Replies

drop down url menu Not using javascript but php

         

chaddsisco

5:23 pm on Sep 20, 2005 (gmt 0)

10+ Year Member



Here is what I have so far

<html>
<head>
<title>What gallery would you like to view</title>
</head>
<body>
<?php
include ('includes/header.inc');
?>
<form name="form1" method="post" action="displaygallery.php"
enctype="multipart/form-data">

<table border="0" cellpadding="5">
<tr>
<td>What gallery would you like to view?<br>
<em>Example: Weddings</em></td>
<td><select name="displaygallery">
<option value="" selected>Select a location....</option>
<option value="http://www.example.com/gallery/centerpieces/gallery_centerpieces1.php">Center Pieces</option>
<option value="classicdecor">Classis Decor</option>
<option value="dancefloors">Dance Floors</option>
<option value="deliverybouquets">Delivery Bouquets</option>
<option value="propsandeffects">Props and Effects</option>
<option value="stagedecor">Stage Decor</option>
<option value="themedecor">Theme Decor</option>
<option value="tradeshows">Trade Shows</option>
<option value="weddings">Weddings</option>
</select>
</td>
</tr>

</table>
<br>
<p align="center"><input type="submit" name="Submit" value="Submit">
&nbsp;
<input type="reset" name="Submit2" value="Clear Form">
</p>
</form>
</body>
</html>

<?php
include ('includes/footer.inc');
?>

and then the displaygallery.php looks like this....

<?
$displaygallery = $_POST['displaygallery'];
header("location: $displaygallery");
?>

Does anyone know why that would not be working for me? Thanks in advance.

[edited by: jatar_k at 5:07 am (utc) on Sep. 21, 2005]
[edit reason] examplified [/edit]

mcibor

8:16 pm on Sep 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think the problem lies within the header.
But tell me, the first doesn't work as well?
If not, then maybe look at the post variable:

<?php
$displaygallery = $_POST['displaygallery'];

echo "Display: $displaygallery<br>";
//header("location: $displaygallery");
?>

If it's correct, then we have a problem.
The other thing is, that you want to redirect to

header("Location: weddings");
That may be a problem. Try redirecting to

header("Location: wedding\");
or even
header("Location: wedding\index.php");

Hope this helps!
Michal Cibor

chaddsisco

12:21 am on Sep 21, 2005 (gmt 0)

10+ Year Member



ok I changed the displaygallary.php like you said and the "echo" shows the correct url that I want to be showen. The problem is when I un-comment the last line I get this error message...

Warning: Cannot modify header information - headers already sent by (output started at /home/pigsinbe/public_html/example/displaygallery.php:4) in /home/pigsinbe/public_html/example/displaygallery.php on line 5

here is what my displaygallery.php file looks like now...

<?php
$displaygallery = $_POST['displaygallery'];

echo "Display: $displaygallery<br>";
header("location: $displaygallery");
?>

Any other ideas why this does not work right for me? Thanks in advance!

[edited by: jatar_k at 5:05 am (utc) on Sep. 21, 2005]
[edit reason] no urls thanks [/edit]

dcrombie

3:20 pm on Sep 21, 2005 (gmt 0)



This seems to be a double-post. Thread continues here:
[webmasterworld.com...]