spanner206 Posted November 25, 2013 Share Posted November 25, 2013 hi once again im in need of help what i need is a double column one with a drop down box called type of business and one hidden one with the id, to me it would seem easier to simply code all of the options in html but the options for type of columns has been coded onto the website, i got a code sent over to me but errors are occurring so just wondering if anybody has any ideas. <td>Type of Business:</td> <select name="typeofbusiness" id="typeofbusiness"> <?php $count = count($_SESSION['typeofbusiness']); for ($i = 0; $i < $count; $i++) { if($_SESSION['id'][$i]!=$_SESSION['Id']){ ?> <option value="<?php echo $_SESSION['id'][$i];?>" <?php if (isset($_REQUEST['typeofbusiness'])&&$_REQUEST['typeofbusiness']==$_SESSION['id'][$i]) { echo'selected="selected"'; }?>><?php echo $_SESSION['typeofbusiness'][$i];?></option> <?php } } ?> ( ! ) Notice: Undefined variable: _SESSION in C:\wamp\www\AddLeads\addeadstemplate.php on line 248 Call Stack # Time Memory Function Location 1 0.0000 186688 {main}( ) ..\addeadstemplate.php:0 any help will be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
requinix Posted November 25, 2013 Share Posted November 25, 2013 You haven't called session_start(). Need to do that before you can use $_SESSION. It also has to happen before you've outputted anything so you can't put it in that code you've posted. Quote Link to comment Share on other sites More sharing options...
spanner206 Posted November 25, 2013 Author Share Posted November 25, 2013 right i put that in now im getting a undefined index on typeofbusiness Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2013 Share Posted November 25, 2013 (edited) You are getting the undefined index for typeofbusiness because it is not set in the $_SESSION Edited November 25, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
spanner206 Posted November 25, 2013 Author Share Posted November 25, 2013 dont think i have set anything, never used $_SESSION before soive got no clue Quote Link to comment Share on other sites More sharing options...
spanner206 Posted November 25, 2013 Author Share Posted November 25, 2013 how would i do it?? Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2013 Share Posted November 25, 2013 dont think i have set anything, never used $_SESSION before soive got no clue So where have you got this code from? You have copied it from somewhere and just expect it to just work. Quote Link to comment Share on other sites More sharing options...
spanner206 Posted November 25, 2013 Author Share Posted November 25, 2013 yh my boss sent it to me heres the original code all i changed was change the name from agent to typeofbusiness. <select name="agentIndex" id="agentIndex"> <?php $count = count($_SESSION['agents']); for ($i = 0; $i < $count; $i++) { if($_SESSION['agentsid'][$i]!=$_SESSION['current_Agent_Id']){ ?> <option value="<?php echo $_SESSION['agentsid'][$i];?>" <?php if (isset($_REQUEST['agentIndex'])&&$_REQUEST['agentIndex']==$_SESSION['agentsid'][$i]) { echo'selected="selected"'; }?>><?php echo $_SESSION['agents'][$i];?></option> <?php } Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2013 Share Posted November 25, 2013 (edited) Well thats for listing the agents. Just renaming the variablesisn't enough. You need to make sure you are setting data to the $_SESSION['typeofbusiness'] variable in order for your code to do anything to it. What is it you are trying to do with the Type of Business field Edited November 25, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
spanner206 Posted November 25, 2013 Author Share Posted November 25, 2013 what my boss wants is for there to be 2 different columns one id column which is hidden and one for the values e.g. in type of business there would be something like trade or somet like that he wants this done because the values are already on his websites which have id's so i can just call the the values by there ids but im just getting confused. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2013 Share Posted November 25, 2013 So where is the types of business stored? Quote Link to comment Share on other sites More sharing options...
spanner206 Posted November 25, 2013 Author Share Posted November 25, 2013 its on our database under tblcontacts but i dont no about the ids cause there not on my version Quote Link to comment Share on other sites More sharing options...
spanner206 Posted November 25, 2013 Author Share Posted November 25, 2013 you no what ill sort this out in a bit this is making me want to shoot myself so ill have a cuppa and do it later Quote Link to comment 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.