Hi, new to php and new quick help on php/wml...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
x2srj
Forum Newbie
Posts: 2
Joined: Wed Nov 22, 2006 9:42 am

Hi, new to php and new quick help on php/wml...

Post by x2srj »

Hi,

I've got a wml page that passes a variable:

<go href="bookingref_truncate.php?bookref=MU4657">

this goes to a PHP page like....

<card id="booking">
<onevent type="ontimer">
<go href="search.wml#step1">

Code: Select all

<?php

$changeBookref = substr('bookref', 0, 2);

if ($changeBookref == "AB"){
   echo "<setvar name=\"bookref\"   value=\"ABBA\" />";
   }
else ($changeBookref == "MU"){
   echo "<setvar name=\"bookref\"   value=\"MUSE\" />";
   }
blah blah blah blah blah blah

This PHP page I need to do two things; one I need to truncate the value to just the first two alphanumerics; and secondly I need the if statement to pick up the value and pass it correctly... The trouble I'm having is I don't appear to be getting the value???

help PLEASE Smiley

Many many thanks in advance Smiley
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Code: Select all

<?php echo substr('bookref', 0, 2); ?>
prints bo
You probably want the first two characters of the http parameter bookmark not the string 'bookmark'. $_GET is an array/hash that stores the http parameters passed via GET (as part of the uri).
try

Code: Select all

$changeBookref = substr($_GET['bookref'], 0, 2);
x2srj
Forum Newbie
Posts: 2
Joined: Wed Nov 22, 2006 9:42 am

Post by x2srj »

Many many thanks :)
Post Reply