Page 1 of 1

php self issues

Posted: Sun Sep 17, 2006 4:54 pm
by plankguy
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I'm trying to make a dynamically generated jump menu, that when an item is selected the form reloads the current page and then displays the info  from the data base based on the selection. Whenever I submit the form, I get an error that the page cannot be found because it's looking for "%3C?page=aamco", where "%3C" should be list.php....

Code: Select all

$currentPage = $_SERVER['PHP_SELF'];
mysql_data_seek ($result, 0);
echo '<form name="franchises" action="<?php echo $currentPage; ?>">';
echo '<select name="page" id="jumper">';
echo '<option selected>Select a Franchise</option>';
echo '<option></option>';
while ($row = mysql_fetch_assoc($result)) {
	$page = $row["index"];
	$name = $row["name"];
	echo '<option value="' . $page . '">' . $name . '</option>';
}
echo '</select>';
echo '&nbsp;<a href="javascript: submitform()">GO</a>';
echo '</form>';
Any ideas??


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Sep 17, 2006 5:05 pm
by feyd
hint: take a look at your generated source page.

Re: php self issues

Posted: Mon Sep 18, 2006 3:34 am
by aerodromoi
plankguy wrote:

Code: Select all

echo '<form name="franchises" action="<?php echo $currentPage; ?>">';
You might want to consider that nesting echos can muddle the acoustic experience ;)