wipe Posted February 6, 2011 Share Posted February 6, 2011 Hi guys, a few days i upgrade php from 5.1 to 5.2.16 all seem fine and last 2 days i start to find some bugs. I use this code to get url var and pass from a form: <?php echo $_GET['id']; ?> <input name="ids" type="hidden" id="ids" value="<?php $_GET['id'];?>" /> In the email i receive all data from the form, but not this that i get from the URL. in code to send to email i just use: $_POST[id] This work fine in 5.1 but not in this version. anyone have an idea why? Wipe Link to comment https://forums.phpfreaks.com/topic/226873-code-bug-after-upgrade-from-php-51-to-52/ Share on other sites More sharing options...
QuickOldCar Posted February 6, 2011 Share Posted February 6, 2011 Are supposed to use either GET or POST, not both, try to change it to all of one type and see if it works. Link to comment https://forums.phpfreaks.com/topic/226873-code-bug-after-upgrade-from-php-51-to-52/#findComment-1170677 Share on other sites More sharing options...
zenlord Posted February 6, 2011 Share Posted February 6, 2011 Look to the HTML of the form. It should be: <form action="" method=""> If 'method' is not defined, default it is set to 'get', and then you have to collect the variable with $_GET['id']. If the method is set to 'post', then you have to fetch the variable with *_POST['id']. You could also choose to fetch the variable with $_REQUEST['id'] - this predefined variable holds the content of $_POST, $_GET and $_COOKIE. Link to comment https://forums.phpfreaks.com/topic/226873-code-bug-after-upgrade-from-php-51-to-52/#findComment-1170683 Share on other sites More sharing options...
Pikachu2000 Posted February 6, 2011 Share Posted February 6, 2011 You need to actually echo the value here: <input name="ids" type="hidden" id="ids" value="<?php $_GET['id'];?>" /> // should be <input name="ids" type="hidden" id="ids" value="<?php echo $_GET['id'];?>" /> Link to comment https://forums.phpfreaks.com/topic/226873-code-bug-after-upgrade-from-php-51-to-52/#findComment-1170702 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.