homepage Welcome to WebmasterWorld Guest from 54.227.160.102
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Echo command has stopped working
glamdring

10+ Year Member



 
Msg#: 6407 posted 5:18 pm on Jan 7, 2005 (gmt 0)

I wonder if someone can help me out : on a site that I run, a PHP script appears to have stopped working : I think my host has upgraded me to the latest version of PHP and maybe this has done it, but I dont know how to fix it:

The variable that gets passed is like this :

<select name="quantity">
<option value="55.00">1 ticket</option>
<option value="110.00">2 tickets</option>
<option value="165.00">3 tickets</option>
<option value="220.00">4 tickets</option>
<option value="275.00">5 tickets</option>
</select>

and what picks it up - and has worked flawlessly until now, in the next page is :

<p align="center" class="style9">Total Cost &pound; <?php echo "$quantity"?></p>

Any suggestions would be welcome - I've about pulled all my hair out with it.

 

mavherick

10+ Year Member



 
Msg#: 6407 posted 5:30 pm on Jan 7, 2005 (gmt 0)

Might be the register global or something.

Did you try echo $_POST['quantity']?

mavherick

glamdring

10+ Year Member



 
Msg#: 6407 posted 5:40 pm on Jan 7, 2005 (gmt 0)

Splendid. That works - thanks.

However...

Those values (along with others) should get passed into a mySQL db by the next page using :

<?
$date = date("Y-m-d G:i:s") ;
$db="databasename";
mysql_query ("INSERT INTO databasename (variable1, variable2, etc) VALUES ('$variable1','$variable2','$etc')");
?>

which has also worked flawlessly until now. The two SQL generated fields, "id" and "date" (datetime) go into the DB okay, but the other eleven-odd fields do not, leaving me with aload of blank entries...

Again, i'm baffled because this has worked fine until now, and then just stopped in the last few days when the upgrade came.

Birdman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 6407 posted 5:51 pm on Jan 7, 2005 (gmt 0)

It's definately the fact that register_globals [php.net] is now turned off.

You will need to go through all your scripts and replace the shortcut references.

...OR...the quick and dirty way

<?php

extract($_POST); // for forms
extract($_GET); // for query string variables

// Now you can leave the rest of the script intact...

glamdring

10+ Year Member



 
Msg#: 6407 posted 6:29 pm on Jan 7, 2005 (gmt 0)

thanks a lot for your help

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved