Solved

session set when i first enter a page on subsequent returns session no longer set

Posted on 2007-11-29
13
260 Views
Last Modified: 2013-12-12
When i first enter a page on my site my session variable $user_id is set perfectly, however when i surf around the site and  click a link to take me to that same page no session variable appears i'am using  print_r($_SESSION); to display session array i'am using php version 5.2.1  Apache/1.3.37  Unix) DAV/1.0.3
below is one of the pages i tried to return to in the link..

in this page none of the data is retreaved from the database on the second return..
<?php

session_start();

$user_id= $_SESSION[user_id];

     print_r($_SESSION);
 
 

require_once('/home/tdothot7/includ/mysql_connect.php');

$query = "SELECT first_name,last_name,country,city,birth_date,sex,age,username,occupation,ethnicity,best_feature,relationship_status,interested_in,looking_for,drinks,style,music,smokes,favorite_body_part FROM users WHERE id='$user_id' LIMIT 1";		

		$result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());

		

		if (@mysql_affected_rows() == 1){ 

 // Register the values & redirect.

			$row = mysql_fetch_array ($result, MYSQL_NUM); 

			mysql_free_result($result);

			mysql_close(); // Close the database connection.

			$first_name= $row[0];

			$last_name = $row[1];

			$country = $row[2];

			$city = $row[3];

			$birth_date = $row[4];

			$sex = $row[5];

			$age= $row[6];

			$username= $row[7];

			$occupation=$row[8];

			$ethnicity=$row[9];

			

			$best_feature=$row[10];

			$relationship_status=$row[11];

			$interested_in=$row[12];

			$looking_for=$row[13];

			$drinks=$row[14];

			$style=$row[15];

			$music=$row[16];

			$smokes=$row[17];

			$body_part=$row[18];

			//$user_id=$row[19];

			

			

			

			

			}

 

 ?>
 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<title>TdotHot! Join Our Comunity</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">

<!--

.mytablewborder {

	border-top: thin solid #003366;

	border-right: thin solid #003366;

	border-bottom: thick solid #003366;

	border-left: thin solid #003366;

}
 

.myborder {

	border-top: thin solid #003366;

	border-right: medium solid #003366;

	border-bottom: medium solid #003366;

	border-left: thin solid #003366;

}
 

.topmemubar{

	border-top: thin none #003366;

	border-right: thin none #003366;

	border-bottom: thin solid silver;

	border-left: thin none #003366;

}
 
 

.mytablewborderb1 {

	border-top: thin solid #003366;

	border-right: thin solid #003366;

	border-bottom: thick solid #003366;

	border-left: thin solid #003366;

}
 

.mytablewborderb2 {

	border-top: thin solid #003366;

	border-right: thin solid #003366;

	border-bottom: thick solid #003366;

	border-left: thin solid #003366;

}
 
 

.mytablewborderYT {

	border-top: thin solid #FFFF00;

	border-right: thin solid;

	border-bottom: medium solid #666666;

	border-left: thin solid;

}

.mytablewborderSl {

	border-top: thin solid silver;

	

}
 
 
 
 
 
 
 

  

.thinborderfloat {float:left;

  border:thin solid silver;

  padding:5px;

  margin-right:10px;

}

.thinborderfloaterr {

  border:thin solid silver;

  padding:5px;

  margin-right:10px;

}

.buttons {font-family: Verdana, Arial, Helvetica, sans-serif;

 font-size: 10px;

 background-color: #333333;

 color: #FFFFFF;

 margin-right: 0px;

}

.passwrd_field {font-size: 10px;

 color: #FFFFFF;

 background-color: #FFFFFF;

 border: 1px solid #000000;

 margin-top: 0em;

}

.usr_name {font-size: 10px;

  color: #000000;

 background-color: #FFFFFF;

 border: 1px solid #000000;

 margin-top: 1em;

}

body {

	background-color: #CCCCCC;

}

.style22 {border-top: thin solid silver; font-size: 10px; }
 

#container {

  margin: 0 auto;

  width: 940px;

  text-align: left;

  }

.style38 {border-top: thin solid #FFFF00; border-right: thin solid; border-bottom: medium solid #666666; border-left: thin solid; font-size: 12px; }

.style40 {

	font-size: 36px;

	color: #FF0000;

	font-weight: bold;

}

.style65 {font-family: Geneva, Arial, Helvetica, sans-serif}

.style64 {	font-size: 12px;

	font-family: Geneva, Arial, Helvetica, sans-serif;

}

.style74 {font-family: Geneva, Arial, Helvetica, sans-serif; color: #000000; }

.style67 {font-size: 12px}

.style68 {

	border-top: thin none #003366;

	border-right: thin none #003366;

	border-bottom: thin solid silver;

	border-left: thin none #003366;

	font-family: Geneva, Arial, Helvetica, sans-serif;

	font-size: 12px;

	color: #FFFFFF;

}

.style70 {color: #0000FF}

.style71 {border-top: thin none #003366; border-right: thin none #003366; border-bottom: thin solid silver; border-left: thin none #003366; font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; color: #0000FF; }

.style75 {color: #3A00FF}

.style76 {color: #000000}

</style>
 

</script>

</head>
 

<body>

<div id="container">

<form action='updateinfo.php' method='get'>

<table width="700" height="644" border="0" cellpadding="0" cellspacing="0" bgcolor="#F0F0FF" class="mytablewborder">

  <tr align="center" bgcolor="#003366">

    <td width="885" height="82"><span class="style40">Under construction ! </span></td>

  </tr>

  <tr bgcolor="#000000">

    <td height="21" class="style38">  </td>

  </tr>

  <tr valign="top">

    <td height="533"><table width="943" height="533">

      <tr>

        <td height="482" align="center" valign="top" bgcolor="lavender"><table width="633" cellpadding="0" cellspacing="0" class="myborder">

          <tr bgcolor="#FFFFFF">

            <td height="23" colspan="10" align="left">&nbsp;</td>

            </tr>

          <tr bgcolor="#FFFFFF">

		  <input type="hidden" name="email" value="<?php echo $email; ?>">

            <td width="35" align="left" class="topmemubar style67">&nbsp;</td>

            <td width="64" align="center" bgcolor="#0000FF" class="style68 ">Basic</td>

            <td width="6" align="left" class="topmemubar style65 style67 style70">&nbsp;</td>

            <td width="64" align="center" bgcolor="#FFFFFF" class="style71 style75">Contact</td>

            <td width="7" align="left" class="style71">&nbsp;</td>

            <td width="114" align="center" class="style71">Upload Picture</td>

            <td width="9" align="left" class="style71">&nbsp;</td>

            <td width="127" align="center" class="style71">Email Password </td>

            <td width="6" align="left" class="topmemubar">&nbsp;</td>

            <td height="23" align="left" class="topmemubar">&nbsp;</td>

            </tr>

          <tr>

            <td height="367" colspan="10" bgcolor="#F5F5F5"><table width="633" bgcolor="#DCDCDC">

              <tr>

                <td width="4" rowspan="14">&nbsp;</td>

                <td width="74">&nbsp;</td>

                <td width="10">&nbsp;</td>

                <td>&nbsp;</td>

                <td colspan="2" rowspan="14">&nbsp;</td>

                <td width="16">&nbsp;</td>

                <td width="21">&nbsp;</td>

                <td width="91">&nbsp;</td>

                <td>&nbsp;</td>

                <td width="12" rowspan="14">&nbsp;</td>

              </tr>

              <tr>

                <td colspan="2" align="right" class="style86 style76 style65 style67"><span class="style67">Username</span>:</td>

                <td width="195"><input name="user_name" type="text" id="user_name"value="<?php echo "$user_name"; ?>"></td>

                <td colspan="3" align="right"><span class="style65 style67">Best Feature: </span></td>

                <td width="165"><select name="best_feature" class="text_box" id="best_feature">

                    <option value="<?php echo $best_feature;?>" selected="TRUE"><?php echo $best_feature;?></option>

                    <option value="Face">Face</option>

                    <option value="Legs">Legs</option>

                    <option value="Booty">Booty</option>

                    <option value="Arms">Arms</option>

                    <option value="Lips">Lips</option>

                    <option value="Abs">Abs</option>

                    <option value="Back">Back</option>

                    <option value="Forearms">forearms</option>

                    <option value="Hips">Hips</option>

                    <option value="Neck">Neck</option>

                    <option value="Thighs">Thighs</option>

                    <option value="Feet">Feet</option>

                    <option value="Toes">Toes</option>

                    <option value="Eyes">Eyes</option>

                    <option value="Brain">Brain</option>

                </select></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">First Name: </span></td>

                <td><input name="first_name" type="text" class="style65" id="first_name" value="<?php echo "$first_name"; ?>"></td>

                <td colspan="3" align="right"><span class="style65 style67">Relationship Status: </span></td>

                <td><select name="relationship_status" class="text_box" id="relationship_status"></option>

                    <option value="<?php echo $relationship_status;?>" selected="TRUE"><?php echo $relationship_status;?>

                    <option value="Single">Single</option>

                    <option value="Married">Married</option>

                    <option value="Engaged">Engaged</option>

                    <option value="Looking">Looking</option>

                </select></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">Last Name:</span></td>

                <td><input name="last_name" type="text" class="style65" id="last_name" value="<?php echo "$last_name"; ?>"></td>

                <td colspan="3" align="right"><span class="style65 style67">Interested In: </span></td>

                <td><select name="interested_in" class="text_box" id="interested_in">

                    <option value="<?php echo $interestd_in;?>" selected="TRUE"><?php echo $interested_in;?></option>

                    <option value="Women">Women</option>

                    <option value="Men">Men</option>

                    <option value="Both">Both</option>

                </select></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">Age:</span></td>

                <td><input name="age" type="text" class="style65" id="age" value="<?php echo "$age"; ?>"></td>

                <td colspan="3" align="right"><span class="style65 style67">Looking For:</span></td>

                <td><select name="looking_for" class="text_box" id="looking_for">

                    <option value="<?php echo $looking_for;?>" selected="TRUE"><?php echo $looking_for;?></option>

                    <option value="Relationship">Relationship</option>

                    <option value="Friends">Friends</option>

                    <option value="Nothing">Nothing</option>

                </select></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">Location:</span></td>

                <td><select name="location" class="text_box">

                    <option value="<?php echo $city;?>" selected="TRUE"><?php echo $city;?></option>

                    

         

                    <option value="Ajax">Ajax</option>

                    <option value="Aurora">Aurora</option>

                    <option value="Barrie">Barrie</option>

                    <option value="Bolton">Bolton</option>

                    <option value="Bradford">Bradford</option>

                    <option value="Brantford">Brantford</option>

                    <option value="Brampton">Brampton</option>

                    <option value="Burlington">Burlington</option>

                    <option value="Cambridge">Cambridge</option>

                    <option value="Chatham">Chatham</option>

                    <option value="Concord">Concord</option>

                    <option value="Etobicoke">Etobicoke</option>

                    <option value="Georgetown">Georgetown</option>

                    <option value="Guelph">Guelph</option>

                    <option value="Hamilton">Hamilton</option>

                    <option value="Kitchener">Kitchener</option>

                    <option value="King City">King City</option>

                    <option value="London">London</option>

                    <option value="Maple">Maple</option>

                    <option value="Milton">Milton</option>

                    <option value="Markham">Markham</option>

                    <option value="Mississauga">Mississauga</option>

                    <option value="Newmarket">Newmarket</option>

                    <option value="Niagara Falls">Niagara Falls</option>

                    <option value="North York">North York</option>

                    <option value="Oakville">Oakville</option>

                    <option value="Oshawa">Oshawa</option>

                    <option value="Ottawa">Ottawa</option>

                    <option value="Peterborough">Peterborough</option>

                    <option value="Pickering">Pickering</option>

                    <option value="Richmond Hill">Richmond Hill</option>

                    <option value="Scarborough">Scarborough</option>

                    <option value="St. Catharines">St. Catharines</option>

                    <option value="Thornhill">Thornhill</option>

                    <option value="Toronto">Toronto</option>

                    <option value="USA">USA</option>

                    <option value="Vaughan">Vaughan</option>

                    <option value="Whitby">Whitby</option>

                    <option value="Woodbridge">Woodbridge</option>

                    <option value="Windsor">Windsor</option>

                    <option value="Somewhere in Ontario">Somewhere in Ontario</option>

                    <option value="Other">Other</option>

                </select></td>

                <td>&nbsp;</td>

                <td colspan="2" align="right"><span class="style65 style67">Drinks:</span></td>

                <td><select name="drinks" class="text_box" id="drinks">

                    <option value="<?php echo $drinks;?>" selected="TRUE"><?php echo $drinks;?></option>

                    <option value="Occassional">Occassional</option>

                    <option value="All The Time">All The Time</option>

                    <option value="Only In The Morning">Only In The Morning</option>

                    <option value="Only In The Night">Only In The Night</option>

                    <option value="Never">Never</option>

                </select></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">Country:</span></td>

                <td><select name="country" class="text_box" id="select3">

                    <option value="<?php echo $country;?>" selected="TRUE"><?php echo $country;?></option>

                    <option value="AF">Afghanistan</option>

                    <option value="AL">Albania</option>

                    <option value="DZ">Algeria</option>

                    <option value="AS">American Samoa</option>

                    <option value="AD">Andorra</option>

                    <option value="AO">Angola</option>

                    <option value="AI">Anguilla</option>

                    <option value="AQ">Antarctica</option>

                    <option value="AG">Antigua and Barbuda</option>

                    <option value="AR">Argentina</option>

                    <option value="AM">Armenia</option>

                    <option value="AW">Aruba</option>

                    <option value="AU">Australia</option>

                    <option value="AT">Austria</option>

                    <option value="AZ">Azerbaijan</option>

                    <option value="BS">Bahamas</option>

                    <option value="BH">Bahrain</option>

                    <option value="BD">Bangladesh</option>

                    <option value="BB">Barbados</option>

                    <option value="BY">Belarus</option>

                    <option value="BE">Belgium</option>

                    <option value="BZ">Belize</option>

                    <option value="BJ">Benin</option>

                    <option value="BM">Bermuda</option>

                    <option value="BT">Bhutan</option>

                    <option value="BO">Bolivia</option>

                    <option value="BA">Bosnia and Herzegovina</option>

                    <option value="BW">Botswana</option>

                    <option value="BV">Bouvet Island</option>

                    <option value="BR">Brazil</option>

                    <option value="IO">British Indian Ocean Territory</option>

                    <option value="BN">Brunei Darussalam</option>

                    <option value="BG">Bulgaria</option>

                    <option value="BF">Burkina Faso</option>

                    <option value="BI">Burundi</option>

                    <option value="KH">Cambodia</option>

                    <option value="CM">Cameroon</option>

                    <option value="CA">Canada</option>

                    <option value="CV">Cape Verde</option>

                    <option value="KY">Cayman Islands</option>

                    <option value="CF">Central African Republic</option>

                    <option value="TD">Chad</option>

                    <option value="CL">Chile</option>

                    <option value="CN">China</option>

                    <option value="CX">Christmas Island</option>

                    <option value="CC">Cocos (Keeling) Islands</option>

                    <option value="CO">Colombia</option>

                    <option value="KM">Comoros</option>

                    <option value="CG">Congo</option>

                    <option value="CK">Cook Islands</option>

                    <option value="CR">Costa Rica</option>

                    <option value="CI">Cote D'Ivoire (Ivory Coast)</option>

                    <option value="HR">Croatia (Hrvatska)</option>

                    <option value="CU">Cuba</option>

                    <option value="CY">Cyprus</option>

                    <option value="CZ">Czech Republic</option>

                    <option value="CS">Czechoslovakia (former)</option>

                    <option value="DK">Denmark</option>

                    <option value="DJ">Djibouti</option>

                    <option value="DM">Dominica</option>

                    <option value="DO">Dominican Republic</option>

                    <option value="TL">East Timor</option>

                    <option value="EC">Ecuador</option>

                    <option value="EG">Egypt</option>

                    <option value="SV">El Salvador</option>

                    <option value="GQ">Equatorial Guinea</option>

                    <option value="ER">Eritrea</option>

                    <option value="EE">Estonia</option>

                    <option value="ET">Ethiopia</option>

                    <option value="FK">Falkland Islands (Malvinas)</option>

                    <option value="FO">Faroe Islands</option>

                    <option value="FJ">Fiji</option>

                    <option value="FI">Finland</option>

                    <option value="FR">France</option>

                    <option value="FX">France, Metropolitan</option>

                    <option value="GF">French Guiana</option>

                    <option value="PF">French Polynesia</option>

                    <option value="TF">French Southern Territories</option>

                    <option value="GA">Gabon</option>

                    <option value="GM">Gambia</option>

                    <option value="GE">Georgia</option>

                    <option value="DE">Germany</option>

                    <option value="GH">Ghana</option>

                    <option value="GI">Gibraltar</option>

                    <option value="GB">Great Britain (UK)</option>

                    <option value="GR">Greece</option>

                    <option value="GL">Greenland</option>

                    <option value="GD">Grenada</option>

                    <option value="GP">Guadeloupe</option>

                    <option value="GU">Guam</option>

                    <option value="GT">Guatemala</option>

                    <option value="GN">Guinea</option>

                    <option value="GW">Guinea-Bissau</option>

                    <option value="GY">Guyana</option>

                    <option value="HT">Haiti</option>

                    <option value="HM">Heard and McDonald Islands</option>

                    <option value="HN">Honduras</option>

                    <option value="HK">Hong Kong</option>

                    <option value="HU">Hungary</option>

                    <option value="IS">Iceland</option>

                    <option value="IN">India</option>

                    <option value="ID">Indonesia</option>

                    <option value="IR">Iran</option>

                    <option value="IQ">Iraq</option>

                    <option value="IE">Ireland</option>

                    <option value="IL">Israel</option>

                    <option value="IT">Italy</option>

                    <option value="JM">Jamaica</option>

                    <option value="JP">Japan</option>

                    <option value="JO">Jordan</option>

                    <option value="KZ">Kazakhstan</option>

                    <option value="KE">Kenya</option>

                    <option value="KI">Kiribati</option>

                    <option value="KP">Korea (North)</option>

                    <option value="KR">Korea (South)</option>

                    <option value="KW">Kuwait</option>

                    <option value="KG">Kyrgyzstan</option>

                    <option value="LA">Laos</option>

                    <option value="LV">Latvia</option>

                    <option value="LB">Lebanon</option>

                    <option value="LS">Lesotho</option>

                    <option value="LR">Liberia</option>

                    <option value="LY">Libya</option>

                    <option value="LI">Liechtenstein</option>

                    <option value="LT">Lithuania</option>

                    <option value="LU">Luxembourg</option>

                    <option value="MO">Macau</option>

                    <option value="MK">Macedonia</option>

                    <option value="MG">Madagascar</option>

                    <option value="MW">Malawi</option>

                    <option value="MY">Malaysia</option>

                    <option value="MV">Maldives</option>

                    <option value="ML">Mali</option>

                    <option value="MT">Malta</option>

                    <option value="MH">Marshall Islands</option>

                    <option value="MQ">Martinique</option>

                    <option value="MR">Mauritania</option>

                    <option value="MU">Mauritius</option>

                    <option value="YT">Mayotte</option>

                    <option value="MX">Mexico</option>

                    <option value="FM">Micronesia</option>

                    <option value="MD">Moldova</option>

                    <option value="MC">Monaco</option>

                    <option value="MN">Mongolia</option>

                    <option value="MS">Montserrat</option>

                    <option value="MA">Morocco</option>

                    <option value="MZ">Mozambique</option>

                    <option value="MM">Myanmar</option>

                    <option value="NA">Namibia</option>

                    <option value="NR">Nauru</option>

                    <option value="NP">Nepal</option>

                    <option value="NL">Netherlands</option>

                    <option value="AN">Netherlands Antilles</option>

                    <option value="NT">Neutral Zone</option>

                    <option value="NC">New Caledonia</option>

                    <option value="NZ">New Zealand</option>

                    <option value="NI">Nicaragua</option>

                    <option value="NE">Niger</option>

                    <option value="NG">Nigeria</option>

                    <option value="NU">Niue</option>

                    <option value="NF">Norfolk Island</option>

                    <option value="MP">Northern Mariana Islands</option>

                    <option value="NO">Norway</option>

                    <option value="OM">Oman</option>

                    <option value="PK">Pakistan</option>

                    <option value="PW">Palau</option>

                    <option value="PA">Panama</option>

                    <option value="PG">Papua New Guinea</option>

                    <option value="PY">Paraguay</option>

                    <option value="PE">Peru</option>

                    <option value="PH">Philippines</option>

                    <option value="PN">Pitcairn</option>

                    <option value="PL">Poland</option>

                    <option value="PT">Portugal</option>

                    <option value="PR">Puerto Rico</option>

                    <option value="QA">Qatar</option>

                    <option value="RE">Reunion</option>

                    <option value="RO">Romania</option>

                    <option value="RU">Russian Federation</option>

                    <option value="RW">Rwanda</option>

                    <option value="GS">S. Georgia and S. Sandwich Isls.</option>

                    <option value="KN">Saint Kitts and Nevis</option>

                    <option value="LC">Saint Lucia</option>

                    <option value="VC">Saint Vincent and the Grenadines</option>

                    <option value="WS">Samoa</option>

                    <option value="SM">San Marino</option>

                    <option value="ST">Sao Tome and Principe</option>

                    <option value="SA">Saudi Arabia</option>

                    <option value="SN">Senegal</option>

                    <option value="SC">Seychelles</option>

                    <option value="SL">Sierra Leone</option>

                    <option value="SG">Singapore</option>

                    <option value="SK">Slovak Republic</option>

                    <option value="SI">Slovenia</option>

                    <option value="Sb">Solomon Islands</option>

                    <option value="SO">Somalia</option>

                    <option value="ZA">South Africa</option>

                    <option value="ES">Spain</option>

                    <option value="LK">Sri Lanka</option>

                    <option value="SH">St. Helena</option>

                    <option value="PM">St. Pierre and Miquelon</option>

                    <option value="SD">Sudan</option>

                    <option value="SR">Suriname</option>

                    <option value="SJ">Svalbard and Jan Mayen Islands</option>

                    <option value="SZ">Swaziland</option>

                    <option value="SE">Sweden</option>

                    <option value="CH">Switzerland</option>

                    <option value="SY">Syria</option>

                    <option value="TW">Taiwan</option>

                    <option value="TJ">Tajikistan</option>

                    <option value="TZ">Tanzania</option>

                    <option value="TH">Thailand</option>

                    <option value="TG">Togo</option>

                    <option value="TK">Tokelau</option>

                    <option value="TO">Tonga</option>

                    <option value="TT">Trinidad and Tobago</option>

                    <option value="TN">Tunisia</option>

                    <option value="TR">Turkey</option>

                    <option value="TM">Turkmenistan</option>

                    <option value="TC">Turks and Caicos Islands</option>

                    <option value="TV">Tuvalu</option>

                    <option value="UG">Uganda</option>

                    <option value="UA">Ukraine</option>

                    <option value="AE">United Arab Emirates</option>

                    <option value="UK">United Kingdom</option>

                    <option value="US">United States</option>

                    <option value="UY">Uruguay</option>

                    <option value="UM">US Minor Outlying Islands</option>

                    <option value="SU">USSR (former)</option>

                    <option value="UZ">Uzbekistan</option>

                    <option value="VU">Vanuatu</option>

                    <option value="VA">Vatican City State (Holy Sea)</option>

                    <option value="VE">Venezuela</option>

                    <option value="VN">Viet Nam</option>

                    <option value="VG">Virgin Islands (British)</option>

                    <option value="VI">Virgin Islands (U.S.)</option>

                    <option value="WF">Wallis and Futuna Islands</option>

                    <option value="EH">Western Sahara</option>

                    <option value="YE">Yemen</option>

                    <option value="YU">Yugoslavia</option>

                    <option value="ZR">Zaire</option>

                    <option value="ZM">Zambia</option>

                    <option value="ZW">Zimbabwe</option>

                </select></td>

                <td>&nbsp;</td>

                <td colspan="2" align="right"><span class="style65 style67">Style:</span></td>

                <td><select name="style" class="text_box" id="style">

                    <option value="<?php echo $style;?>" selected="TRUE"><?php echo $style;?></option>

                    <option value="Thug">Thug</option>

                    <option value="Skater">Skater</option>

                    <option value="Punk">Punk</option>

                    <option value="Dancehall">Dancehall</option>

                    <option value="Rasta">Rasta</option>

                    <option value="Bboy">Bboy</option>

                    <option value="Mean">Mean</option>

                    <option value="Crunk">Crunk</option>

                    <option value="Badman">Badman</option>

                    <option value="Gangsta">Gangsta</option>

                    <option value="Nice">Nice</option>

                    <option value="Gq">Gq</option>

                    <option value="Other"></option>

                </select></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">Gender:</span></td>

                <td><select name="sex" class="text_box" id="sex"></option>

                    <option value="<?php echo $sex;?>" selected="TRUE"><?php echo $sex;?></option>

                    <option value="Male">Male</option>

                    <option value="Female">Female</option>

                </select></td>

                <td>&nbsp;</td>

                <td colspan="2" align="right"><span class="style65 style67">Music:</span></td>

                <td><select name="music" class="text_box" id="music">

                    <option value="<?php echo $music;?>" selected="TRUE"><?php echo $music;?></option>

                    <option value="61">2-step</option>

                    <option value="59">A'cappella</option>

                    <option value="125">Acousmatic / Tape music</option>

                    <option value="1">Acoustic</option>

                    <option value="73">Afro-beat</option>

                    <option value="2">Alternative</option>

                    <option value="3">Ambient</option>

                    <option value="93">Americana</option>

                    <option value="65">Big Beat</option>

                    <option value="51">Black Metal</option>

                    <option value="4">Bluegrass</option>

                    <option value="5">Blues</option>

                    <option value="105">Bossa Nova</option>

                    <option value="60">Breakbeat</option>

                    <option value="129">Breakcore</option>

                    <option value="118">Celtic</option>

                    <option value="134">Chinese pop</option>

                    <option value="135">Chinese traditional</option>

                    <option value="6">Christian</option>

                    <option value="7">Christian Rap</option>

                    <option value="8">Classic Rock</option>

                    <option value="77">Classical</option>

                    <option value="110">Classical - Opera and Vocal</option>

                    <option value="9">Club</option>

                    <option value="10">Comedy</option>

                    <option value="126">Concrete</option>

                    <option value="11">Country</option>

                    <option value="85">Crunk</option>

                    <option value="12">Death Metal</option>

                    <option value="63">Disco House</option>

                    <option value="70">Down-tempo</option>

                    <option value="50">Drum & Bass</option>

                    <option value="68">Dub</option>

                    <option value="123">Dutch pop</option>

                    <option value="67">Electro</option>

                    <option value="127">Electroacoustic</option>

                    <option value="13">Electronica</option>

                    <option value="14">Emo</option>

                    <option value="133">Emotronic</option>

                    <option value="15">Experimental</option>

                    <option value="107">Flamenco</option>

                    <option value="16">Folk</option>

                    <option value="17">Folk Rock</option>

                    <option value="88">Freestyle</option>

                    <option value="119">French pop</option>

                    <option value="18">Funk</option>

                    <option value="124">Fusion</option>

                    <option value="56">Garage</option>

                    <option value="120">German pop</option>

                    <option value="86">Ghettotech</option>

                    <option value="79">Glam</option>

                    <option value="112">Gospel</option>

                    <option value="46">Gothic</option>

                    <option value="95">Grime</option>

                    <option value="47">Grindcore</option>

                    <option value="19">Grunge</option>

                    <option value="71">Happy Hardcre</option>

                    <option value="57">Hard House</option>

                    <option value="20">Hardcore</option>

                    <option value="91">Hawaiian</option>

                    <option value="104">Healing & EasyListening</option>

                    <option value="21">Hip Hop</option>

                    <option value="22">House</option>

                    <option value="83">Hyphy</option>

                    <option value="69">IDM</option>

                    <option value="97">Idol</option>

                    <option value="23">Indie</option>

                    <option value="45">Industrial</option>

                    <option value="121">Italian pop</option>

                    <option value="24">Jam Band</option>

                    <option value="103">Japanese Classic Music</option>

                    <option value="25">Jazz</option>

                    <option value="100">J-POP</option>

                    <option value="58">Jungle</option>

                    <option value="101">K-POP</option>

                    <option value="49">Latin</option>

                    <option value="128">Live Electronics</option>

                    <option value="75">Lounge</option>

                    <option value="113">Lyrical</option>

                    <option value="102">Melodramatic Popular Song</option>

                    <option value="26">Metal</option>

                    <option value="131">Minimalist</option>

                    <option value="87">Neo-soul</option>

                    <option value="76">New Wave</option>

                    <option value="66">Nu-Jazz</option>

                    <option value="27">Other</option>

                    <option value="28">Pop</option>

                    <option value="29">Pop Punk</option>

                    <option value="130">Post punk</option>

                    <option value="31">Powerpop</option>

                    <option value="32">Progressive</option>

                    <option value="62">Progrsv House</option>

                    <option value="33">Psychedelic</option>

                    <option value="43">Psychobilly</option>

                    <option value="34">Punk</option>

                    <option value="35">R&B</option>

                    <option value="36">Rap</option>

                    <option value="37">Reggae</option>

                    <option value="84">Reggaeton</option>

                    <option value="89">Regional Mexican</option>

                    <option value="111">Religious</option>

                    <option value="38">Rock</option>

                    <option value="44">Rockabilly</option>

                    <option value="94">Roots Music</option>

                    <option value="115">Salsa</option>

                    <option value="116">Samba</option>

                    <option value="39">Screamo</option>

                    <option value="78">Shoegaze</option>

                    <option value="96">Showtunes</option>

                    <option value="40">Ska</option>

                    <option value="41">Soul</option>

                    <option value="42">Southern Rock</option>

                    <option value="122">Spanish pop</option>

                    <option value="48">Surf</option>

                    <option value="114">Swing</option>

                    <option value="108">Tango</option>

                    <option value="53">Techno</option>

                    <option value="54">Thrash</option>

                    <option value="52">Trance</option>

                    <option value="132">Trance</option>

                    <option value="55">Trip Hop</option>

                    <option value="92">Tropical</option>

                    <option value="80">Turntablism</option>

                    <option value="99">Visual</option>

                    <option value="90">Western Swing</option>

                    <option value="117">Zouk</option>

                </select></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">Birth Date: </span></td>

                <td><input name="birth_date" type="text" class="style65" id="birth_date" value="<?php echo "$birth_date"; ?>"></td>

                <td>&nbsp;</td>

                <td colspan="2" align="right"><span class="style65 style67">Smokes:</span></td>

                <td><select name="smokes" class="text_box" id="smokes">

                    <option value="<?php echo $smokes;?>" selected="TRUE"><?php echo $smokes;?></option>

                    <option value="Occasional">Occasional</option>

                    <option value="Just Green">Just Green</option>

                    <option value="All The Time">All The Time</option>

                    <option value="Nope">Nope</option>

                </select></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">Occupation</span><span class="style76 style65 style67">:</span></td>

                <td><input name="occupation" type="text" class="style65" id="occupation" value="<?php echo "$occupation"; ?>"></td>

                <td><span class="style67"></span></td>

                <td colspan="2">&nbsp;</td>

                <td align="left" valign="bottom"><span class="style64">(on opposite sex) </span></td>

              </tr>

              <tr>

                <td colspan="2" align="right"><span class="style65 style67">Ethnicity</span><span class="style76 style65 style67">:</span></td>

                <td><input name="ethnicity" type="text" class="style65" id="ethnicity"></td>

                <td colspan="3" align="right"><span class="style65 style67">Favorite Body Part:</span></td>

                <td><select name="body_part" class="text_box" id="body_part">

                    <option value="<?php echo $body_part;?>" selected="TRUE"><?php echo $body_part;?></option>

                    <option value="Face">Face</option>

                    <option value="Legs">Legs</option>

                    <option value="Shoulders">Arms</option>

                    <option value="Booty">Booty</option>

                    <option value="Arms">Arms</option>

                    <option value="Lips">Lips</option>

                    <option value="Abs">Abs</option>

                    <option value="Back">Back</option>

                    <option value="Forearms">forearms</option>

                    <option value="Hips">Hips</option>

                    <option value="Neck">Neck</option>

                    <option value="Thighs">Thighs</option>

                    <option value="Feet">Feet</option>

                    <option value="Toes">Toes</option>

                    <option value="Eyes">Eyes</option>

                </select></td>

              </tr>

              <tr>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td><span class="style65"></span></td>

                <td><span class="style65"></span></td>

                <td><span class="style65"></span></td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

              </tr>

              <tr>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td><span class="style65"> </span>

                    <table width="144">

                      <tr>

                        <td width="65"><input type="submit" name="Submit" value="Save Changes"></td>

                        <td width="8">&nbsp;</td>

                        <td width="56"><input type="submit" name="Submit2" value="Cancel"></td>

                      </tr>

                    </table>

                    <span class="style65"> </span></td>

                <td><span class="style65"></span></td>

                <td colspan="3"><span class="style65"></span></td>

              </tr>

              <tr>

                <td height="37">&nbsp;</td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

                <td>&nbsp;</td>

              </tr>

            </table></td>

          </tr>

        </table>

          <table width="633">

          <tr>

            <td width="495">&nbsp;</td>

          </tr>

        </table>

          <p>&nbsp;</p></td>

      </tr>

      <tr>

        <td width="933" height="43" align="center" class="style22"> &copy; 2007 TdotHot  Networks &nbsp;&middot;&nbsp; Privacy Policy&nbsp;&middot;&nbsp; Terms of Service  &nbsp;&middot;&nbsp; Online Safety &nbsp;&middot;&nbsp; About Us &nbsp;&middot;&nbsp; Blog &nbsp;&middot;&nbsp; Advertising &nbsp;&middot;&nbsp; Jobs &nbsp;&middot;&nbsp; Help  </td>

      </tr>

    </table></td>

  </tr>

</table>

</form>

<p>&nbsp;</p>

</div>

</body>

</html>

Open in new window

0
Comment
Question by:perrieriley
  • 7
  • 5
13 Comments
 
LVL 17

Expert Comment

by:psimation
Comment Utility
Where is $_SESSION[user_id] set : I'm assuming on one of your other pages? If so, do you have session_start() at the top of that page?

0
 
LVL 21

Expert Comment

by:nizsmo
Comment Utility
hi perrieriley:

1. For sessions to work you will need to be on the same domain (for the session variables to be accessible).
2 try replace this line:
$user_id= $_SESSION[user_id];

with this line:
$user_id= $_SESSION["user_id"];

basically you need quotes setting a session variable, and retrieving it, so modify where you set your "user_id" session variable accordingly with the quotes as well for your session variables to work.

hope this helps.
0
 

Author Comment

by:perrieriley
Comment Utility
all files are in the same domain. I tried the $user_id = "$user_id"] the files are in different folders, i dont no if that makes a differents..
0
 
LVL 21

Expert Comment

by:nizsmo
Comment Utility
different folders should be alright, but different subdomains are not:

http://sub1.mydomain.com
http://sub2.mydomain.com

these 2 domains won't carry across from each other the session variables.

also this:
$user_id = "$user_id"]

is invalid.

Only put the " inside the session variables I demonstrated in my previous post.

So your original script would look something like:
<?php

session_start();

$user_id= $_SESSION["user_id"];

print_r($_SESSION);
 

// etc....
 

//...

?>

Open in new window

0
 

Author Comment

by:perrieriley
Comment Utility
that was a typo in my comment its correct in my code...
0
 
LVL 21

Expert Comment

by:nizsmo
Comment Utility
so they are on the same domain?
You can try a simple 2 file script, see if this works:

##file1.php

<?php
session_start();
$_SESSION["test"] = "hello, its working!";
if(isset($_SESSION["test"])
    echo "Session set, now go to <a href=\"file2.php\">file2.php</a>";
session_write_close();
?>

##file2.php
<?php
session_start();
echo $_SESSION["test"];
session_write_close();
?>


does file 2 echo the session variable?
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:perrieriley
Comment Utility
i took your two examples put them in different files executed them on the server and i keep getting this error when it gets to th session_write_close(0;--------Parse error: syntax error, unexpected T_STRING
0
 

Author Comment

by:perrieriley
Comment Utility
sorry i meant session_write_close();
0
 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
Comment Utility
sorry perrieriley, file2.php should work fine, in file1.php i missed a bracket, please replace file1.php with this:


<?php
session_start();
$_SESSION["test"] = "hello, its working!";
if(isset($_SESSION["test"]))
    echo "Session set, now go to <a href=\"file2.php\">file2.php</a>";
session_write_close();
?>
0
 

Author Comment

by:perrieriley
Comment Utility
seems to be working perfectly... seems like session_write_close(); might have solve my problem i will continue my testing on my site code with the session_close_write(); please keep monitoring my posts nizsmo your a life saver.... what might have been happening...?
0
 

Author Comment

by:perrieriley
Comment Utility
you no what i meant...
0
 

Author Closing Comment

by:perrieriley
Comment Utility
thank you very much....
0
 
LVL 21

Expert Comment

by:nizsmo
Comment Utility
Sometimes for some reason without the session_write_close(); the changes you make to the session variables do not apply properly, thus it is always a good practice to use session_write_close() to close off a session which is being written.

Glad to be of help, and glad you solved your problem!
I will always be around the PHP section mainly, so if you have PHP related questions I am bound to come and join in with the discussion :)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now