PHP - Cant Even Get Basics Right :/
I was reading how to do some beginner stuff in PHP so this to you guys is easy right?
Why dosent the code work properly? And or am I trying stuff that is to advanced for a total noob??
this is the php code from the tutorial:
<?php
Similar TutorialsI could use some help remembering how sessions and cookies work... (Looks like another thing I have forgotten about!) In one of my old scripts, I start a session using...
session_start()
And then I have...
$sessMemberID = (isset($_SESSION['sessMemberID']) ? $_SESSION['sessMemberID'] : '');
It appears my old naming conventions aren't so clear after being away for several years... In my database I have a MEMBER.id (table/column) which is just an AutoNumber, and I thought that PHP create a "Session ID" but that it was some long hexadecimal number?
So it's not clear to me what is in $sessMemberID.
I tried to look in the cookies file under my Firefox profile, but when I open it in BBEdit all i see is gibberish in that file.
Can someone please help me put these disparate parts together?
Thanks!
Could anyone point me in the right direction for downloading app store statistics from: -the Apple App Store -The Android Market -the Amazon AppStore Specifically, I'd like to get the -average selling price of apps -the top selling apps -the distribution of tablets vs. phones, etc. (e.g. how many apps are there for Honeycomb? How many for iPad?) -total number of apps in store -free vs. paid apps I've seen some sites like http://148apps.biz/app-store-metrics/ and http://www.appbrain.com/stats/ How do these sites get their data? There must be a way to export the whole app store database as a CSV file, or import it to MySQL and run queries. Thanks much for any direction. nothing is echoed for the second foreach??? foreach($pictures as $picture) -im breaking cause it's a large file Code: [Select] $doc = new DOMDocument(); $doc->load('accommodation.xml'); $i = 0; $accommodations = $doc->getElementsByTagName('accommodation'); foreach($accommodations as $accommodation) { if(++$i > 2) break; $supplierID = $accommodation->getElementsByTagName('code')->item(0)->nodeValue; $pictures = $accommodation->getElementsByTagName('pictures')->item(0)->nodeValue; $pictures=array(); foreach($pictures as $picture) { echo $url = $picture->getElementsByTagName('url')->item(0)->nodeValue; } }//end //XMl schema <?xml version="1.0" encoding="utf-8"?> <accommodations> <accommodation> <code>1</code> <pictures> <picture> <url>http://example.com/images.k.jpg</url> </picture> </pictures> I've been using PHP includes for a while now but I've just started to try to get more advanced. (not much more) I'm using this code to both generate my page titles and give my li tags a class of active so I can style them with css as being in a down state. All is working but I just need a more efficient way of doing this I think. I currently have Code: [Select] <?php $title = basename($_SERVER['SCRIPT_NAME'], '.php'); if ($title == 'index') { $title = 'home'; } $title = ucfirst($title); $title = str_replace('-', ' ', $title); $title = ucwords($title); ?> Then in my unordered list I have Code: [Select] <?php if ($title == 'Product Selector'||$title == 'Kingston Range') {echo 'class="active"';} ?> I could continue to say if title = a or b or c or d etc but could I use an array to store all of these titles and check to see if the title is in the array? or is there a better way to do this? Thanks in advance This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=317962.0 if anyone out there fancy's helping the needy please can you cast your eyes over my mess! and possibly help me find my way out of this maze? So im useing a third party form, and a third party php script.......... cant get them to work together . form script : [color=red//-------------------------------------------------[/color] <form action="phpquote.php" method="post" id="reserve-form"> <div class="box"> <div class="left-top-corner"> <div class="right-top-corner"> <div class="border-top"></div> </div> </div> <div class="border-left"> <div class="border-right"> <div class="xcontent"> <h5>Get an online quote for your journey</h5> <p>please fill in all fields for your quote.</p> <fieldset> <div class="field"> <label>Customer Information</label> <input type="text" id="name" value="Name" onblur="if(this.value==''){this.value='Name'}" onfocus="if(this.value=='Name'){this.value=''}" /> </div> <div> <input type="text" id="number" value="Phone" onblur="if(this.value==''){this.value='Phone'}" onfocus="if(this.value=='Phone'){this.value=''}" /> </div> </fieldset> <fieldset class="style1"> <div class="field"> <label>Travel Date/ Time</label> <select id="year"> <option>2010</option> <option>2011</option> </select> <select class="sel-1" id="month"> <option>Jan</option> <option>Feb</option> <option>Mar</option> <option>Apr</option> <option>May</option> <option>Jun</option> <option>Jul</option> <option>Aug</option> <option>Oct</option> <option>Sep</option> <option>Nov</option> <option>Dec</option> </select> <select class="sel-2" id="date"> <option>1</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select> </div> <div class="field"> <select class="sel-2" id="time"> <option>00</option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option></select> <select class="sel-2" id="time"> <option>00</option> <option>15</option> <option>30</option> <option>45</option> </select> </div> <div class="field"> <label>No. Passangers</label> <select id="year"> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> </select> </div> </fieldset> <fieldset class="style2"> <div class="field"> <label>Pickup Information</label> <input type="text" id="where" value="Pickup Address" onblur="if(this.value==''){this.value='Pickup Address'}" onfocus="if(this.value=='Pickup Address'){this.value=''}" /> </div> <div> <select id="where"> <option>or Airport</option> <option>Stansted</option> <option>Gatwick</option> <option>Heathrow</option> <option>Luton</option> </select> </div> </fieldset> <fieldset class="style2 style3"> <div class="field"> <label>Drop-off Information</label> <input type="text" id="to" value="Drop-off Address" onblur="if(this.value==''){this.value='Drop-off Address'}" onfocus="if(this.value=='Drop-off Address'){this.value=''}" /> </div> <div> <select id="to"> <option>or Airport</option> <option>Stansted</option> <option>Gatwick</option> <option>Heathrow</option> <option>Luton</option> </select> </div> </fieldset> </div> </div> </div> <div class="left-bot-corner"> <div class="right-bot-corner"> <div class="border-bot"><a href="#" class="link2" onclick="document.getElementById('reserve-form').submit()"><em><b>Get Quote</b></em></a></div> </div> </div> </div> </form> //----------------------------------------------------------------------------- php script //----------------------------------------------------------------------------- <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Results from Contact form'; // Your email address. This is where the form information will be sent. $emailadd = 'm.mcdade@hotmail.co.uk'; // Where to redirect after form is processed. $url = 'http://www.mock.thetaxirank.co.uk/thankyou.html'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> //----------------------------------------------------------------------------- any advice will be appreciated..... thanks in advance to any kind souls !!! |