Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 7th, 2003, 02:13 PM
Registered User
 
Join Date: Aug 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to lyonsdigital
Default What's wrong here?

I'm using what should be a very simple script. Anyone got a clue what I've done wrong? I can't get the variable to show when I refresh the page. It's in the url, but the echo statements are blank.

<html>

    <head>
        <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
        <meta name="generator" content="Adobe GoLive 6">
        <title>Scentco: Newscasts</title>
    </head>

    <body bgcolor="#ffffff">

        <br>
        <br>
        Select a clip from the list below. At this time only newsclips featuring Paint Pourri are available for download.
        <br>
        <br>
        <form action="index.php" method="get">
            <select name="station">
                <option value="wtsp">Tampa WTSP</option>
                <option value="kdka">Pittsburg KDKA</option>
                <option value="wtvg">Toledo WTVG</option>
                <option value="wroc">Rochester WROC</option>
            </select>
                <br>
                <br>
            <input type=submit value="Play Newsclip">
        </form>
        <?php
        echo "The variable is: $station";
        echo "<embed src=\"ppouri$station.mov\" type=\"video/quicktime\">";
        ?>
    </body>


</html>

The page is online at: http://www.scentco.net/newscasts

Jonathan Lyons
Lyons Digital Media

Survival Guide to Printing and Graphics at:
http://www.lyonsdigital.com
 
Old August 7th, 2003, 02:28 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

You probably have the register_globals directive turned off.

There are several existing posts which address this topic. And the following URL discusses why register_globals is turned off and what to do instead.

http://www.php.net/manual/en/languag...predefined.php

Basically what you need to do is use the $_GET superglobal array (PHP 4.1 or later) OR $HTTP_GET_VARS (PHP prior to 4.1).

So your reference to the $station variable should look like this:

echo "The variable is: {$_GET["station"]}";
echo "<embed src=\"ppouri{$_GET["station"]}.mov\" type=\"video/quicktime\">";

The curly braces tells PHP that the object enclosed in curly braces is a variable and will avoid a parse error from the use of quotes in the array.

This is Nikolai's register_globals FAQ:
http://p2p.wrox.com/archive/beginnin...2002-11/17.asp

Another topic on register_globals:
http://p2p.wrox.com/topic.asp?TOPIC_ID=2429

A topic discussing curly brace syntax and strings:
http://p2p.wrox.com/topic.asp?TOPIC_ID=2469

hth,
Rich


:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old August 7th, 2003, 02:43 PM
Registered User
 
Join Date: Aug 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to lyonsdigital
Default

THANK YOU! THANK YOU! THANK YOU!

This client doesn't use my preferred ISP and I've not run into this problem before. What a pain in the... Well, you know.

You've been a lifesaver. If you'd like, check out the clips. They're working now.

Jonathan Lyons
Lyons Digital Media

Survival Guide to Printing and Graphics at:
http://www.lyonsdigital.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
What's wrong ??? FT BOOK: ASP.NET Website Programming Problem-Design-Solution 2 November 3rd, 2005 09:18 AM
Help..What am I doing wrong... Brettvan1 VB.NET 2002/2003 Basics 2 October 18th, 2004 02:36 AM
Where did I go wrong??? ahc2inc VB.NET 2002/2003 Basics 3 September 28th, 2004 08:19 PM
What's wrong?Help! amu BOOK: Beginning ASP.NET 1.0 1 October 28th, 2003 08:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.