xbase Posted April 25, 2006 Share Posted April 25, 2006 Can you please explain what I am doing wrong? Every tutorial I see doesnt cover what I am doing it seems.[code]<?// START THE SESSIONsession_start();// SET THE CONFIGURATIONrequire('includes/config.php'); // SET VARIABLES $morgage_type = $_POST['$morgage_type']; $loan_amount = $_POST['$loan_amount']; $loan_type = $_POST['$loan_type']; $amortization_type = $_POST['$amortization_type']; $subject_address = $_POST['$subject_address']; $subject_county = $_POST['$subject_county']; $subject_units = $_POST['$subject_units']; $subject_description = $_POST['$subject_description']; $subject_title = $_POST['$subject_title']; $subject_title_manner = $_POST['$subject_title_manner']; $subject_pay_source = $_POST['$subject_pay_source']; $amortization_type = $_POST['$amortization_type']; $lot_aquired = $_POST['$lot_aquired']; $lot_cost = $_POST['$lot_cost']; $lot_liens = $_POST['$lot_liens']; $lot_value = $_POST['$lot_value']; $lot_improve = $_POST['$lot_improve']; $refi_aquired = $_POST['$refi_aquired']; $refi_cost = $_POST['$refi_cost']; $refi_liens = $_POST['$refi_liens']; $refi_purose = $_POST['$refi_purose']; $refi_desc_improve = $_POST['$refi_desc_improve']; $refi_cost = $_POST['$refi_cost']; // REGISTER SESSIONS session_register ($morgage_type); session_register ($loan_amount); session_register ($loan_type); session_register ($amortization_type); session_register ($subject_address); session_register ($subject_county); session_register ($subject_units); session_register ($subject_description); session_register ($subject_title); session_register ($subject_title_manner); session_register ($subject_pay_source); session_register ($amortization_type); session_register ($lot_aquired); session_register ($lot_cost); session_register ($lot_liens); session_register ($lot_value); session_register ($lot_improve); session_register ($refi_aquired); session_register ($refi_cost); session_register ($refi_liens); session_register ($refi_purpose); session_register ($refi_desc_improve); session_register ($refi_cost);?><html><head> <title><? echo $conf['name'],' - ',$app['name']; ?></title> <link rel="stylesheet" type="text/css" href="includes/styles/main.css"></head><body><?phpif ($step == '2') {echo "<form action=\"?step=3&sid=$PHPSESSID\" method=\"post\"><table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"600\" align=\"center\"> <tr> <td colspan=\"3\" id=\"header\">SECTION 2 - PROPERTY INFORMATION AND PURPOSE OF LOAN</td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Subject Property Address<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_address\" size=\"80\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> County<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_county\" size=\"30\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Number of Units<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_units\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Property Description<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_description\" size=\"80\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Name(s) to be on title<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_title\" size=\"50\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Manner in which title will be held<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_title_manner\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Source of Down Payment<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"subject_pay_source\" size=\"80\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Estate will be held in?<br> </td> <td width=5></td> <td id=\"input\"> <select name=\"amortization_type\"> <option value=\"\">Select Hold Type <option value=\"Fee Simple\">Fee Simple <option value=\"Lease Hold\">Lease Hold </SELECT> </td> </tr> <tr> <td id=\"input\" valign=\"middle\" colspan=\"3\" align=\"center\"> NOTE: Please only complete this section if consturction or construction-permanent loan<br> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Year Lot Aquired<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_aquired\" size=\"5\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Origional Cost<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_cost\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Amount of Existing Liens<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_liens\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> A. Present Value of lot<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_value\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> B. Cost of Improvements<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_improve\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Total (A + B)<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"lot_aquired\" size=\"10\"> </td> </tr><tr> <td id=\"input\" valign=\"middle\" colspan=\"3\" align=\"center\"> NOTE: Please only complete this section if this is a refiance loan </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Year Lot Aquired<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_aquired\" size=\"5\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Origional Cost<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_cost\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Amount of Existing Liens<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_liens\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Purpose of Refinance<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_purose\" size=\"10\"> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Description of Improvements<br> </td> <td width=5></td> <td id=\"input\"><textarea value=\"\" name=\"refi_desc_improve\" rows=\"2\" cols=\"40\"></textarea> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\"> Cost of Improvements<br> </td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" name=\"refi_cost\" size=\"10\"> </td> </tr> <tr> <td id=\"input\" align=\"center\" colspan=\"3\"> <input type=\"submit\" value=\"Submit\"></td> </tr> </table>";} if ($step == '3') { echo $lot_cost;} else if ($step < 2) {echo "<form action=\"?step=2&sid=$PHPSESSID\" method=\"post\"><table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"600\" align=\"center\"> <tr> <td colspan=\"3\" id=\"header\">SECTION 1 - TYPE OF MORTGAGE AND TERMS OF LOAN</td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Mortgage Type</td> <td width=5></td> <td id=\"input\"> <select name=\"morgage_type\"> <option value=\"\">Select A Mortgage Type <option value=\"VA\">VA <option value=\"FHA\">FHA <option value=\"Conventional\">Conventional <option value=\"USDA/Rural Housing Service\">USDA/Rural Housing Service <option value=\"Other\">Other </SELECT> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Loan Amount</td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" size=\"15\" name=\"loan_amount\"></td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Loan Term</td> <td width=5></td> <td id=\"input\"> <select name=\"loan_term\"> <option value=\"\">Select A Loan Term <option value=\"5 Year\">5 Year <option value=\"10 Year\">10 Year <option value=\"15 Year\">15 Year <option value=\"20 Year\">20 Year <option value=\"25 Year\">25 Year <option value=\"30 Year\">30 Year </SELECT></td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Amortization Type</td> <td width=5></td> <td id=\"input\"> <select name=\"amortization_type\"> <option value=\"\">Select Amortization Type <option value=\"Fixed Rate\">Fixed Rate <option value=\"GPM\">GPM <option value=\"ARM\">ARM <option value=\"Other\">Other </SELECT> </td> </tr> <tr> <td id=\"input\" align=\"center\" colspan=\"3\"> <input type=\"submit\" value=\"Submit\"></td> </tr></table>";}?></form></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/8326-session-handling-problems/ Share on other sites More sharing options...
bbaker Posted April 25, 2006 Share Posted April 25, 2006 if you have register_globals set to off in your php.ini, session_register will not work. You should use $_SESSION instead. $_SESSION['morgage_type'] = $morgage_type; $_SESSION['loan_amount'] = $loan_amount; $_SESSION['loan_type'] = $loan_type; $_SESSION['amortization_type'] = $amortization_type;etc...etc. Quote Link to comment https://forums.phpfreaks.com/topic/8326-session-handling-problems/#findComment-30380 Share on other sites More sharing options...
kenrbnsn Posted April 25, 2006 Share Posted April 25, 2006 Even if you have register_globals enabled, don't use session_register. Use the explicit references to the $_SESSION array and please read the manual section on [a href=\"http://www.php.net/session\" target=\"_blank\"]sessions[/a].BTW, you can probably shorten your code greatly by:[code]<?php// Set the variablesextract($_POST);// create and store the session variablesforeach($_POST as $k => $v) if ($k != 'submit') // I'm assuming you don't want to store the submit key if (!isset($_SESSION[$k])) $_SESSION[$k] = $v; // This wil not overwrite any previously stored session values. If you don't care, remove the "if (!isset($_SESSION[$k]))".?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/8326-session-handling-problems/#findComment-30391 Share on other sites More sharing options...
xbase Posted April 25, 2006 Author Share Posted April 25, 2006 ok this is what i am working on [a href=\"http://www.nmlco.com/secure/\" target=\"_blank\"]http://www.nmlco.com/secure/[/a]. I am still having trouble printing any of the session data. please if you can help me at all either reply or message me or pm me.here is my new index.php[code]<?// INCLUDE SESSION FILErequire('includes/sessions.php');// SET THE CONFIGURATIONinclude('includes/config.php');?><html><head> <title><? echo $conf['name'],' - ',$app['name']; ?></title> <link rel="stylesheet" type="text/css" href="includes/styles/main.css"></head><body><?phpif(isset($step)){ if($step == '1') // Gets from the variable $step the section number { $step = "1"; } include("includes/part/section".$step.".php"); // Include the file associated with the variable $step}else{ include("includes/part/section1.php");}?></body></html>[/code]HERE is my sessions.php file[code] // START THE SESSION session_start(); // SET VARIABLES extract($_POST); foreach($_POST as $k => $v) if ($k != 'submit') if (!isset($_SESSION[$k])) $_SESSION[$k] = $v;[/code]Here is my section1.php file[code]if ($step > 0) { $var = $step + 1;} else { $step = '1'; $var = $step + 1;}echo "<form action=\"?step=$var&sid=$PHPSESSID\" method=\"post\"> <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"600\" align=\"center\"> <tr> <td colspan=\"3\" id=\"header\">SECTION 1 - TYPE OF MORTGAGE AND TERMS OF LOAN</td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Mortgage Type</td> <td width=5></td> <td id=\"input\"> <select name=\"morgage_type\"> <option value=\"\">Select A Mortgage Type <option value=\"VA\">VA <option value=\"FHA\">FHA <option value=\"Conventional\">Conventional <option value=\"USDA/Rural Housing Service\">USDA/Rural Housing Service <option value=\"Other\">Other </SELECT> </td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Loan Amount</td> <td width=5></td> <td id=\"input\"><input type=\"text\" value=\"\" size=\"15\" name=\"loan_amount\"></td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Loan Term</td> <td width=5></td> <td id=\"input\"> <select name=\"loan_term\"> <option value=\"\">Select A Loan Term <option value=\"5 Year\">5 Year <option value=\"10 Year\">10 Year <option value=\"15 Year\">15 Year <option value=\"20 Year\">20 Year <option value=\"25 Year\">25 Year <option value=\"30 Year\">30 Year </SELECT></td> </tr> <tr> <td id=\"field\" width=200 valign=\"middle\">Amortization Type</td> <td width=5></td> <td id=\"input\"> <select name=\"amortization_type\"> <option value=\"\">Select Amortization Type <option value=\"Fixed Rate\">Fixed Rate <option value=\"GPM\">GPM <option value=\"ARM\">ARM <option value=\"Other\">Other </SELECT> </td> </tr> <tr> <td id=\"input\" align=\"center\" colspan=\"3\"> <input type=\"submit\" value=\"Submit\"></td> </tr></table>";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/8326-session-handling-problems/#findComment-30609 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.