Welcome to WebmasterWorld Guest from 54.163.35.238

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Echo command has stopped working

     

glamdring

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

10+ Year Member



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

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

10+ Year Member



Might be the register global or something.

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

mavherick

glamdring

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

10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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

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

10+ Year Member



thanks a lot for your help
 

Featured Threads

Hot Threads This Week

Hot Threads This Month