Welcome to WebmasterWorld Guest from 54.147.44.13

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Echo command has stopped working

     
5:18 pm on Jan 7, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 9, 2004
posts:51
votes: 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.

5:30 pm on Jan 7, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 3, 2002
posts:169
votes: 0


Might be the register global or something.

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

mavherick

5:40 pm on Jan 7, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 9, 2004
posts:51
votes: 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.

5:51 pm on Jan 7, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 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...

6:29 pm on Jan 7, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:June 9, 2004
posts:51
votes: 0


thanks a lot for your help