jalea148 Posted July 13, 2008 Share Posted July 13, 2008 :-X here's a snippit - code worked in php4; not in php5. Form variables First, Last etc are blank. <?php session_start(); session_register('sessFirst'); session_register('sessLast'); session_register('sessAddr'); session_register('sessAddr2'); session_register('sessCity'); session_register('sessZip'); session_register('sessPhone'); session_register('sessEmail'); $sessFirst = $_POST['First']; $sessLast = $_POST['Last']; $sessAddr = $_POST['Addr']; $sessAddr2 = $_POST['Addr2']; $sessCity = $_POST['City']; $sessZip = $_POST['Zip']; $sessPhone = $_POST['Phone']; $sessXmail = $_POST['Email']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> .................. <form action=".......................... > .................. <p> <input name="First" id="First" type="text" class="req" size="20" tabindex="1" value="<?php echo $sessFirst; ?>"/> <span class="style12"> Last </span> <input name="Last" id="Last" type="text" class="req" size="20" tabindex="2" value="<?php echo $sessLast; ?>" /> </p> .................... <body> </body> </html> Link to comment https://forums.phpfreaks.com/topic/114534-php5-session-variables-from-_post/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 13, 2008 Share Posted July 13, 2008 This has nothing to do with php4 vs php5. The code is using an old depreciated function session_register(). session_register only works when register globals are on (register globals were turned off by default in php 4.2 in the year 2002 and have completely been eliminated in php6.) You need to use the session_start() function and the $_SESSION variable array instead. Link to comment https://forums.phpfreaks.com/topic/114534-php5-session-variables-from-_post/#findComment-588970 Share on other sites More sharing options...
jalea148 Posted July 14, 2008 Author Share Posted July 14, 2008 This has nothing to do with php4 vs php5. The code is using an old depreciated function session_register(). session_register only works when register globals are on (register globals were turned off by default in php 4.2 in the year 2002 and have completely been eliminated in php6.) You need to use the session_start() function and the $_SESSION variable array instead. Thanks - you sent me in the right direction. However, in <p> <input name="First" id="First" type="text" class="req" size="20" tabindex="1" value="<?php echo $sessFirst; ?>"/> <span class="style12"> Last </span> <input name="Last" id="Last" type="text" class="req" size="20" tabindex="2" value="<?php echo $sessLast; ?>" /> </p> the passed data does not appear. Instead, when you double click in the field a pull down menu appears and the session variable value is one of the menu items. Link to comment https://forums.phpfreaks.com/topic/114534-php5-session-variables-from-_post/#findComment-589890 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.