A lot of help please

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
mrtdunn
-


Joined: 27 Jan 2005
Posts: 16
Location: Joplin,MO

PostPosted: Thu Jan 19, 2006 4:27 am    Post subject: A lot of help please Reply with quote

Ok guys. What I'd like to do is have a certain set of variables, say city names for example, in a drop menu. I would like to be able to select a city name and click a go button which will then display information regarding said city. I'd like to stay away from incorporating databases and just use a php file to call the information from. The drop down menu is a cinch for me. However making php do what I'd like it to do is not so. I'm not much of a programmer, but when I figure out what does what I can edit like nobodys business. Any and all help will be greatly appreciated. Thanks.
Back to top View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Tom Chapman
-


Joined: 09 Jul 2005
Posts: 933
Location: Australia

PostPosted: Thu Jan 19, 2006 7:31 am    Post subject: Reply with quote

http://www.abyssunderground.co.uk/scripts-phponefile.php

This would be perfect for you!

Kindest Regards Tom.
Back to top View user's profile Send private message Visit poster's website MSN Messenger
comwiz3000
-


Joined: 19 Nov 2005
Posts: 51
Location: Wellington, NZ

PostPosted: Thu Jan 19, 2006 11:26 am    Post subject: Reply with quote

Hi!
Have a look at this script. It looks very similar to your normal dropdown menu and all you would need to do is click the city. But it is in javascript. Does javascript work in PHP? I no it works in HTML.

http://javascript.internet.com/navigation/cool-pulldown-menu.html
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Tom Chapman
-


Joined: 09 Jul 2005
Posts: 933
Location: Australia

PostPosted: Thu Jan 19, 2006 11:29 am    Post subject: Reply with quote

Depends I think but I'm no pro at php. :-D
Back to top View user's profile Send private message Visit poster's website MSN Messenger
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Thu Jan 19, 2006 11:50 am    Post subject: Reply with quote

JavaScript is client side not server side. It has nothing to do with PHP, however you can echo JavaScript with PHP so it gets to the browser.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
Tom Chapman
-


Joined: 09 Jul 2005
Posts: 933
Location: Australia

PostPosted: Thu Jan 19, 2006 12:03 pm    Post subject: Reply with quote

I thought it was something like that ;-P
Back to top View user's profile Send private message Visit poster's website MSN Messenger
mrtdunn
-


Joined: 27 Jan 2005
Posts: 16
Location: Joplin,MO

PostPosted: Thu Jan 19, 2006 4:24 pm    Post subject: Reply with quote

Thanks for the input thus far all. Sadly, I've stumped. With the amount of information I have, it seems like I'm going to have to use a db. Here is an example of what I'm trying to do. http://www.limousine-chicago-illinois.com Note the Check our Rates form and the information it displays on submit. My lack of programming knowledge is driving me bonkers here. I'm going to go back to sitting in the corner rocking and tapping myself in the forehead for a while. Thanks again.
Back to top View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Thu Jan 19, 2006 5:11 pm    Post subject: Reply with quote

All you need is a simple php script to do it. I see what you want now. You need it so you click the submit button and it checks the value of the drop down list. The php file searches through an array or a load of ifs (array will be better) and redirects the frame to the page with those rates on, correct?

If so you could use javascript for it, but PHP might be easier.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
mrtdunn
-


Joined: 27 Jan 2005
Posts: 16
Location: Joplin,MO

PostPosted: Thu Jan 19, 2006 8:15 pm    Post subject: Reply with quote

That is exactly what I want it to do. But I have idea on how to make a script that will do that. If anyone knows where I might find a script that will do this please........show me the way. Thanks.
Back to top View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Thu Jan 19, 2006 8:40 pm    Post subject: Reply with quote

I could help you with the If's one but its a lot of work, where as some one could design on using arrays so it goes to the page that you used the value of, for example, when you click UK, the value is united_kindom so the php script will make it go to united_kindom.html.

Mine will be long winded. Someone with more php knowledge will be better.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Thu Jan 19, 2006 9:34 pm    Post subject: Reply with quote

OK, I came up with a very small solution.

The code probably wont work because I havent tested it. But here goes. You'll have to fault find or see if someone corrects it. :-)

Code:
<?php

$gotopage = $_POST['menu']; //menu is the name of the field in your form

header("Location: $gotopage");

?>


Make each value in your form the name of the page you want it to go to, eg. uk.html, usa.html.

Set it up to post to that php file and it should work no problems, except for fault finding to start with if it doesnt.

Hope this helps.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Thu Jan 19, 2006 9:49 pm    Post subject: Reply with quote

I just read the first post so whatever.
Code:
<html>...
<?php
$cities = array("cardiff" => "Capitol city of Wales.", "london" => "Capitol city of England.");
// Upper case on the key name will CENSORED it up, if you want to upper case specific words only, you'll have to create a second array and loop through the keys and lower case them for selection.
if ($_GET['do_view'] && $_GET['city'] !== "" && array_key_exists($_GET['city'], $cities))
    echo $cities[$_GET['city']];
else {
?>
<form action='<?=$_SERVER['PHP_SELF']?>' method=get>
<select name='city'>
<?php
foreach(array_flip($cities) as $city)
  echo "<option value='".$city."'>".ucwords($city)."</option>\n";
?>
</select>
<br>
<input type='submit' name='do_view' value='View City'>
</form>
<? } ?>
...</html>


The Inquisitor -> You could just one-line that.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Thu Jan 19, 2006 9:54 pm    Post subject: Reply with quote

Try and do that with yours ;-)
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
MonkeyNation
-


Joined: 05 Feb 2005
Posts: 921
Location: Cardiff

PostPosted: Thu Jan 19, 2006 10:06 pm    Post subject: Reply with quote

Code:

<?php $cities = array("cardiff" => "Capitol city of Wales.", "london" => "Capitol city of England.");
if ($_GET['do_view'] && $_GET['city'] !== "" && array_key_exists($_GET['city'], $cities)) echo $cities[$_GET['city']]; else foreach(array_flip($cities) as $city) echo "<a href='?do_view=1&city=".$city."'>".ucwords($city)."</a>, "; ?>

The array doesn't count.
_________________
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number
mrtdunn
-


Joined: 27 Jan 2005
Posts: 16
Location: Joplin,MO

PostPosted: Fri Jan 20, 2006 1:21 am    Post subject: Reply with quote

Wow. Now to stop my head from spinning and sort through this and see what I can come up with. Thanx very much for all the suggestions.
Back to top View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group