Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #41 (permalink)  
Old 02-19-2012, 09:28 AM
Banned
Latest Blog:
None

 
Join Date: 05-01-06
Location: I live in the real world!
Posts: 329
iTrader: 0 / 0%
Since you have session_start(); at the top of your property.php file...Do me a favor.

In your property.php file echo out your values. in the property.php file.

Add these right below your session_start();

echo $_SESSION['TYPE'] . '<br />';
echo $_SESSION['DURATION'] . '<br />';
echo $_SESSION['AREA'] . '<br />';
echo $_SESSION['REGION'] . '<br />';
echo $_SESSION['BEDROOMS'] . '<br />';

Save the file.

Then from your search.php file, make your selections.
Then click on the 'view apartment'

When you click on it, it will obviously lead you to the property.php and you should see the values you have for each session variable echoed out.
 
Reply With Quote
  #42 (permalink)  
Old 02-19-2012, 10:14 AM
sstoney200's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 12-03-10
Location: Essex, UK
Posts: 273
iTrader: 0 / 0%
Quote:
Originally Posted by an0n View Post
Since you have session_start(); at the top of your property.php file...Do me a favor.

In your property.php file echo out your values. in the property.php file.

Add these right below your session_start();

echo $_SESSION['TYPE'] . '<br />';
echo $_SESSION['DURATION'] . '<br />';
echo $_SESSION['AREA'] . '<br />';
echo $_SESSION['REGION'] . '<br />';
echo $_SESSION['BEDROOMS'] . '<br />';

Save the file.

Then from your search.php file, make your selections.
Then click on the 'view apartment'

When you click on it, it will obviously lead you to the property.php and you should see the values you have for each session variable echoed out.
It's don't appear to be echoing anything out. I just have 5 <br />'s at the top of my page?
__________________
for-rent-nerja.com Rent Apartments in Nerja, Spain!
Website Designers Essex Website Designers and Company Branding in Essex and London, UK!
 
Reply With Quote
  #43 (permalink)  
Old 02-19-2012, 10:23 AM
Banned
Latest Blog:
None

 
Join Date: 05-01-06
Location: I live in the real world!
Posts: 329
iTrader: 0 / 0%
Then your session variables are not being initially set properly!

Add that same exact code to the search.php file right after the session_start
Then tell me if you see the correct values
 
Reply With Quote
  #44 (permalink)  
Old 02-19-2012, 10:42 AM
Banned
Latest Blog:
None

 
Join Date: 05-01-06
Location: I live in the real world!
Posts: 329
iTrader: 0 / 0%
Quote:
Originally Posted by sstoney200 View Post
Thanks for your continued assistance dude!

Well spotted, it's now holding the values on search.php and I've edited the property.php like so:

PHP Code:
<form action="http://www.for-rent-nerja.com/search.php" method="get" name="search" id="search"  style="background-color:#fcf5f8">
      <span class="t_color3"><u><b>Property Search</b></u></span><br />
      <br />
      Property Ref:<br />
      <input type="text" size="15" id="REF" name="REF" /><br />
      Property Type:<br />
      <select id="TYPE" name="TYPE" style="width: 120px">
        <option value=""<?php echo ('$TYPE' == '') ? ' selected="selected"' ''?>>Any</option>
        <option value="apartment"<?php echo ('$TYPE' == 'Apartment') ? ' selected="selected"' ''?>>Apartment</option>
        <option value="villa"<?php echo ('$TYPE' == 'Villa') ? ' selected="selected"' ''?>>Villa</option>
        <option value="townhouse"<?php echo ('$TYPE' == 'Townhouse') ? ' selected="selected"' ''?>>Townhouse</option>
        
      </select>
      <br />
      Duration:<br />
      <select  id="DURATION" name="DURATION" style="width: 120px">
        <option value="holiday"<?php echo ('$DURATION' == 'holiday') ? ' selected="selected"' ''?>>Holiday</option>
        <option value="long term"<?php echo ('$DURATION' == 'long term') ? ' selected="selected"' ''?>>Long Term</option>
        <option value="sale"<?php echo ('$DURATION' == 'sale') ? ' selected="selected"' ''?>>Sale</option>
      </select>
      <br />
      Town:<br />
      <select id="AREA" name="AREA" style="width: 120px" onchange="onRegionChange()">
        <option value="Nerja"<?php echo ('$AREA' == 'Nerja') ? ' selected="selected"' ''?>>Nerja</option>
        <option value="Torrox"<?php echo ('$AREA' == 'Torrox') ? ' selected="selected"' ''?>>Torrox</option>
        <option value="Frigiliana"<?php echo ('$AREA' == 'Frigiliana') ? ' selected="selected"' ''?>>Frigiliana</option>
        <option value="Maro"<?php echo ('$AREA' == 'Maro') ? ' selected="selected"' ''?>>Maro</option>
      </select>
      <div id="allForms">Area:<br />
        <select id="REGION" name="REGION" style="width: 120px">
            <option value=""<?php echo ('$REGION' == '') ? ' selected="selected"' ''?>>Any</option>
            <option value="Central"<?php echo ('$REGION' == 'Central') ? ' selected="selected"' ''?>>Central</option>
            <option value="Burriana"<?php echo ('$REGION' == 'Burriana') ? ' selected="selected"' ''?>>Burriana</option>
            <option value="Capistrano"<?php echo ('$REGION' == 'Capistrano') ? ' selected="selected"' ''?>>Capistrano</option>
            <option value="Torrecilla"<?php echo ('$REGION' == 'Torrecilla') ? ' selected="selected"' ''?>>Torrecilla</option>
            <option value="Punta Lara"<?php echo ('$REGION' == 'Punta Lara') ? ' selected="selected"' ''?>>Punta Lara</option>
            <option value="Parador"<?php echo ('$REGION' == 'Parador') ? ' selected="selected"' ''?>>Parador</option>
            <option value="Carabeo"<?php echo ('$REGION' == 'Carabeo') ? ' selected="selected"' ''?>>Carabeo</option>
            <option value="Las Minas"<?php echo ('$REGION' == 'Las Minas') ? ' selected="selected"' ''?>>Las Minas</option>
            <option value="La Noria"<?php echo ('$REGION' == 'La Noria') ? ' selected="selected"' ''?>>La Noria</option>
            <option value="Tamango Hill"<?php echo ('$REGION' == 'Tamango Hill') ? ' selected="selected"' ''?>>Tamango Hill</option>
            <option value="Countryside"<?php echo ('$REGION' == 'Countryside') ? ' selected="selected"' ''?>>Countryside</option>
        </select>
    </div> 
      Bedrooms:<br />
      <select id="BEDROOMS" name="BEDROOMS" style="width: 120px">
        <option value="1 bedroom"<?php echo ('$BEDROOMS' == '1 bedroom') ? ' selected="selected"' ''?>>1</option>
        <option value="2 bedroom"<?php echo ('$BEDROOMS' == '2 bedroom') ? ' selected="selected"' ''?>>2</option>
        <option value="3 bedroom"<?php echo ('$BEDROOMS' == '3 bedroom') ? ' selected="selected"' ''?>>3</option>
        <option value="4 bedroom"<?php echo ('$BEDROOMS' == '4 bedroom') ? ' selected="selected"' ''?>>4</option>
        <option value="5 bedroom"<?php echo ('$BEDROOMS' == '5 bedroom') ? ' selected="selected"' ''?>>5+</option>
      </select>
      <br />
      <br />
      <input name="submit" type="submit" class="text1" value=
"Submit" />
      <input type="reset" name="Clear" value="Reset" class=
"text1" />
    </form>
but it's still not sticking through!


One other thing looking into your code as well is your value vs what you are looking for

e.g.

<option value="apartment"<?php echo ($TYPE == 'Apartment') ? ' selected="selected"' : ''; ?>>Apartment</option>


the value you are giving this is all lowercase 'apartment'
when you are comparing the $TYPE from the session variable to the text you are after you have 'Apartment'

apartment != Apartment



So you will not have a match at all, and since it will be eventually set to some value, it wont be equal to '' either.
 
Reply With Quote
  #45 (permalink)  
Old 02-19-2012, 12:36 PM
ScriptMan's Avatar
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,248
iTrader: 4 / 100%
There might also be a session_destroy or unset somewhere in the code. You have to follow the complete flow of the scripts in order to figure all this out.
__________________
SEO does not mean Spam Everywhere Online
Scriptman's Playhouse || Ramblings from an old man
2013 resolution: Don't feed trolls
ScriptMan
 
Reply With Quote
  #46 (permalink)  
Old 02-20-2012, 12:52 PM
sstoney200's Avatar
Contributing Member
Latest Blog:
None

 
Join Date: 12-03-10
Location: Essex, UK
Posts: 273
iTrader: 0 / 0%
Hey guys, just a quick update.

I contacted my host and they edited my php settings and now I am able to hold values!

The only field I am not currently able to hold is the area.

I don't know if this is because they are defined by javascript like so:

Code:
<script type="text/javascript"> var slData = new Array( new Array("Any", "", "Central", "Central", "Burriana", "Burriana", "Capistrano", "Capistrano", "Torrecilla", "Torrecilla", "Punta Lara", "Punta Lara", "Parador", "Parador", "Carabeo", "Carabeo", "Las Minas", "Las Minas", "La Noria", "La Noria", "Tamango Hill", "Tamango Hill", "Countryside", "Countryside"), new Array("Any", "", "Beach Front", "Beach Front", "Beach Club", "Beach Club", "Torrox Park", "Torrox Park", "Village", "Village", "Peñoncillo", "Penoncillo", "Countryside", "Countryside", "Frigiliana Road", "Frigi Road", "El Morche", "El Morche"), new Array("Any", "", "Village", "Village", "La Molineta", "La Molineta", "Los Caracoles", "Caracoles", "San Rafael", "San Rafael", "Los Tablazos", "Los Tablazos", "Pinomar", "Pinomar", "Countryside", "Countryside"), new Array("Any", "", "Beach Front", "Beach Front") ); function appendOptionLast(selId, oText, oValue) { var elOptNew = document.createElement('option'); elOptNew.text = oText; elOptNew.value = oValue; var elSel = document.getElementById(selId); try { elSel.add(elOptNew, null); // standards compliant; doesn't work in IE } catch(ex) { elSel.add(elOptNew); // IE only } return; } function onRegionChange() { document.getElementById("REGION").options.length = 0; for(var a = 0; a != slData[document.getElementById("AREA").selectedIndex].length; a = a + 2) { appendOptionLast("REGION", slData[document.getElementById("AREA").selectedIndex][a], slData[document.getElementById("AREA").selectedIndex][a + 1]); } return; } </script>
It is holding the values for the areas of the first town array: Nerja

But for the other town arrays: Torrox, Frigiliana and Maro, the regions aren't sticking, it's resetting the values back to all.

I managed to hold the value of the areas on to my search page using this crazy code:

Code:
<script type="text/javascript"> function gup( varname ) varname = varname.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+varname+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1].replace("+"," "); } var selRegionArray = new Array("Nerja", "Torrox", "Frigiliana", "Maro"); var selRegionOpt = gup("AREA"); for(var b = 0; b != document.getElementById("AREA").length; b++) { if(document.getElementById("AREA").item(b).value == selRegionOpt) { document.getElementById("AREA").selectedIndex = b; break; } } onRegionChange(); var selAreaOpt = gup("REGION"); for(b = 0; b != document.getElementById("REGION").length; b++) { if(document.getElementById("REGION").item(b).value == selAreaOpt) { document.getElementById("REGION").selectedIndex = b; break; } } </script>
but that's not holding the area values over to the property.php page..

So it's not perfect but it's still pretty darn good!

May I just take this opportunity to thanks all of you that have helped me out on this thread, you've all been excellent!
__________________
for-rent-nerja.com Rent Apartments in Nerja, Spain!
Website Designers Essex Website Designers and Company Branding in Essex and London, UK!
 
Reply With Quote
  #47 (permalink)  
Old 02-28-2012, 04:30 AM
shanebob's Avatar
Junior Member
 
Join Date: 02-27-12
Posts: 5
iTrader: 0 / 0%
A SESSION variable is the nice way to track the user perspective information. Using it you can identify whether user is logged in or not. So that you can use SESSION variable for it. In php a SESSION variable can define like :

$_SESSION["username"]="name_of_user";
 
Reply With Quote
  #48 (permalink)  
Old 02-28-2012, 10:01 AM
RiptideTempora's Avatar
Contributing Member
 
Join Date: 11-30-11
Location: Orlando, FL
Posts: 220
iTrader: 0 / 0%
Quote:
Originally Posted by shanebob View Post
A SESSION variable is the nice way to track the user perspective information. Using it you can identify whether user is logged in or not. So that you can use SESSION variable for it. In php a SESSION variable can define like :

$_SESSION["username"]="name_of_user";


Welcome to the thread. Is the Admiral busy?
__________________
This Link Will Self-Destruct
Keenotes - A place for sharp minds
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
session_start(); only works once? curtisjwinton Coding Forum 1 10-24-2009 02:57 AM
Warning: session_start(): rarca Coding Forum 3 01-19-2009 10:39 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 02:53 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.