HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Ok. I'm blind. I need help.

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#1739 (In Topic #400)

Fan in action

Ok. I'm blind. I need help.

Ok. I'm at a total loss here. I keep getting a parse error on the line in question. Say I have cat = melee, the line would be where $type = melee is…

I only supply cat with valid values (which I mention with the 'if' thing)

Does anyone see anything wrong? Why do I keep getting a parse error?!?!?!?! :angry: :angry:

 :lol:

I just don't get it. I opened and closed every { and }. I used ""; with echo, I made sure to use ' and not " with the a href…

I've been scratching my head for half an hour. I just can't seem to figgure out what's the problem :(

Code

<?php
do_page_title("Weaponsmith Catalogue");

$type = "{$_GET['cat']}";

if ($type == melee) {
 echo "<LI><A HREF='index.php?page=view&cat=melee&weap=knuckler'>Vibro Knuckler</A>";
}

if ($type == 1handed) {
 echo "<LI><A HREF='index.php?page=view&cat=1handed&weap=curvedsword'>Curved Sword</A>";
 echo "<LI><A HREF='index.php?page=view&cat=1handed&weap=gaderiffi'>Gaderiffi Baton</A>";
 echo "<LI><A HREF='index.php?page=view&cat=1handed&weap=survivalknife'>Survival Knife</A>";
 echo "<LI><A HREF='index.php?page=view&cat=1handed&weap=sword'>Sword</A>";
}

if ($type == 2handed) {
 echo "<LI><A HREF='index.php?page=view&cat=2handed&weap=heavyaxe'>Heavy Axe</A>";
 echo "<LI><A HREF='index.php?page=view&cat=2handed&weap=handedaxe'>2-Handed Axe</A>";
}

if ($type == carabines) {
 echo "<LI><A HREF='index.php?page=view&cat=carabines&weap=cdef'>CDEF Carabine</A>";
 echo "<LI><A HREF='index.php?page=view&cat=carabines&weap=dh17'>DH17 Carabine</A>";
 echo "<LI><A HREF='index.php?page=view&cat=carabines&weap=dh17short'>DH17 Short Carabine</A>";
}

if ($type == pistols) {
 echo "<LI><A HREF='index.php?page=view&cat=pistols&weap=cdef'>CDEF Pistol</A>";
 echo "<LI><A HREF='index.php?page=view&cat=pistols&weap=d18'>D18 Pistol</A>";
 echo "<LI><A HREF='index.php?page=view&cat=pistols&weap=dl44'>DL44 Pistol</A>";
 echo "<LI><A HREF='index.php?page=view&cat=pistols&weap=dl44metal'>DL44 Metal Pistol</A>";
 echo "<LI><A HREF='index.php?page=view&cat=pistols&weap=fwg5'>FWG5 Pistol</A>";
 echo "<LI><A HREF='index.php?page=view&cat=pistols&weap=scout'>Scout Blaster</A>";
 echo "<LI><A HREF='index.php?page=view&cat=pistols&weap=striker'>Striker Pistol</A>";
}

if ($type == munition) {
 echo "<LI><A HREF='index.php?page=view&cat=munition&weap=c12grenade'>CDEF Rifle</A>";
 echo "<LI><A HREF='index.php?page=view&cat=munition&weap=c22grenade'>DLT20 Rifle</A>";
 echo "<LI><A HREF='index.php?page=view&cat=munition&weap=drxmine'>DRX Mine</A>";
}

?>

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#1740
Avatar

You have to quote string values….

$type == "melee"

not

$type == melee


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#1747

Fan in action

Bah. I had a feeling the problem was something stupid like that :lol:

Thanks :) ;)

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: