PDA

View Full Version : new to php


Mickie D
03-23-2003, 06:52 PM
i am making my own little programme for my members

lets start from the start:

my members would like a page where they could put in a location and on the other page it shows good places around that area...

this is how my code looks so far

<?php
include("global.php");

eval("dooutput(\"".gettemplate("places")."\");");

///// START PLACES CODE /////
if ($Your_Town == "London") {
$GoodSpot = "Bagleys night club";
}

///// END PLACES CODE /////


?>

this is all called from a "post" command and a text box on the page b4 this, so if they put london i want it just to say bagleys

i know if i was not using the forums templates i could put

print ="bagleys";

and just have a normal php page ... but i really like it intergrated into my forums, please help :)

can someone tell me how to get it to print from the templates $goodspot

i have put $goodspot in the template for this page but it wont get it :(

Xenon
03-23-2003, 09:07 PM
the eval code must be below the define of goodspot.

Mickie D
03-23-2003, 09:20 PM
thanks very much for your help could you just show how you mean i been learning php for 5 days now :)

i think i am learning fast, but i really could do with a bit of help thanks :)

Mickie D
03-23-2003, 09:28 PM
yes i got it to work ;)

thanks so much :)

you are fantastic, thanks again i will be posting in here quite a bit so i will appologise now lol

Mickie D
03-23-2003, 09:45 PM
right i am using this code below but i get the same result from my page no matter what i put in it :(

the result is always your town is Manchester you should try bagleys night club

here is the code

if ($Your_Town == "London" or "london") {
$goodspot = "bagleys night club";
} elseif ($Your_Town == "Manchester" or "manchester"){
$goodspot = "space consala";
}

please note i am using another page b4 this one, and it uses a html form to post the $Your_Town infomation :)

colicab-d
03-23-2003, 10:10 PM
hey what you should do is create a form with lots of values in it for (name of each town) and that way the forms name=name will be $name and you can then have it user enabled :D

Mickie D
03-23-2003, 10:14 PM
sorry m8 that went a little over my head ... do you mean make bigger arrays ????

with all the names in one array ???

colicab-d
03-23-2003, 10:26 PM
yeah basically like do a mutli selection form and anyvalue set in that will then equal one $city instead of defining lots of seperate $londons , $manchester etc

you can have have (im too tired for exact code)

if $city = london {

echo "london is big";
}

else

echo "your town is poop"

Mickie D
03-23-2003, 10:58 PM
you cant use echo in a page that is intergrated into the forums because of the templates :(

but i have it sorted thanks to bane

it was my coding i had the "London" or "london" and it never understood, so bane gave me a code that stoped the matter for capitolization (if thats how you spell it lol)

working like a dream

colicab-d
03-24-2003, 08:03 PM
erm yes you can ive been writing admin cp hacks and echo is working fine for me lol

Mickie D
03-24-2003, 08:28 PM
as the tittle says "new to php" .... but thanks for the help