Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About paulonline2501

  • Rank

Contact Methods

  • Website URL

Profile Information

  • Location
    London, UK
  • Interests
    php, (x)html, cats, music
  1. Hi, this is not my code but its giving me trouble on a site. the code works in IE. but in Crome there is a radio button that is defaulted to not show some text. when the user switches to the other radio button (three are just two) the text is supposed to display. it works in IE but not Crome. is the text below enough or do you want to see the code for the whole page? <script type="text/javascript">$(document).ready(function() { $("input:radio[alt-id='test-hide']").change(function() { if(this.checked && this.value == "Y") {$("div#other-questions").show();}if(t
  2. elseif(htmlentities($db_oregion)==htmlentities("North & Islands")){echo("North, Highlands & Islands");} switch ($db_oregion) { case "Central": echo "Central Scotland"; break; case "East": echo "East Anglia"; break; case "Mid": echo "Mid & West Wales"; break; case "North": echo "North Wales"; break; case "North & Islands": echo "North, Highlands & Islands"; break; default: echo "$db_oregion";} thanks for all the replies. I tried using htmlentities [see above], and switch [see above] but neither worked. I w
  3. paulonline2501

    php if else

    hi everyone, I'm having trouble with a PHP if statement. I'm getting a value back from a database. the values stored in the DB aren't exactly what I want to display so im going to do a inline conversion on them. I want to say for example: if the region = 'central' then display 'central Scotland'. ive added my conversion but the value that is stored in the DB is showing rather than the converted value. can anyone spot what is wrong? UPDATE: OK, so it works for all of these apart from the "North & Islands" one. all othere convert, but this one doesn't. it doesn't change to
  4. ....actually, I think ive got it working but i'm sure there is a way to write it in a more elegant way.here's what I wrote: <?php $myString = trim($myString, ","); $myArray = explode(",", $myString); echo("<p>Exploded string in array:</p><ul>"); foreach($myArray as $thisValue) { $i=0; $thisPartsValueID=""; $thisPartsValueQuantity=""; $myArrayParts = explode("-", $thisValue); foreach($myArrayParts as $thisPartsValue) { if($i==0){echo("<li>id=".$thisPartsValue."</li>");$thisPartsValueID=$thisPartsValue;$i++;} else{echo("<li>quantity=".$thisPartsV
  5. yeah, thanks justsomeguy, but how do you get it into the sub array?
  6. <p><?php$myString = "45-2,34-2,35-1,";echo($myString);?></p><?php$myString = trim($myString, ",");$myArray = explode(",", $myString);echo("<p>Exploded string in array:</p><ul>");foreach($myArray as $thisValue){ echo("<li>".$thisValue."</li>");}echo("</ul>");?> I got the first explode working but struggling with the 2nd explode.
  7. ...thanks justsomeguy. yeah, I found something on exploding and am trying it now. I've got the first explode working, and even managed to trim the trailing comma to stop it from being put in the array.
  8. hi, I've got a variable being passed to me from a third party website. in the following format "45-1," where 45 would be the item id and 1 would be the quantity. the variable could hold a few key pairs. eg: "45-1,46-3,5-3,"the first number is always the item id and the 2nd number is always the quantity. each pair separated by a comma. there is always a trailing comma. I need to deconstruct these pairs and deduct the quantity from the correct item in the products table in my database. My question is, what is the best way to deconstruct these pairs?im guessing I should put these in to an array.n
  9. I got it working with the following code but if you have any improvements let me know. This code will always display the folder as empty. Opps.... foreach (glob('../../_documents/*.*',GLOB_NOCHECK) as $file){ $fileName = basename($file); if ($fileName = '*.*'){echo("<li>There are currently no files in this folder.</li>");break;} if ($fileName != 'index.php') {?> <li><?php echo"$fileName"?></li> <?php }//end if}//end foreach
  10. Hi, Does any one know how to display a message instead of the warning error when there are no files in the folder you are doing a directory list of? I have the following code, which produces a list of files in the folder. The only problem is when the folder is empty. I get a foreach error only when there are no files in the folder. I can forsee that sometimes the folders will be empty so will want to show my own error instead of this server warning. I think the "GLOB_NOCHECK" function may help but this may actually only work with folders rather than files. The code that w
  11. I'm trying to set the quantity of an item in an HTML Paypal button. I'm creating the buttons dynamically using a HTML template and values from my products table in my database [php/mysql]. I know you can set the quantity of an an item in the paypal buttons you can make on the the paypal website, but I want to make the buttons dynamically and avoid this step. I have generated the rest of the button without problem - they currently have name, price, postage etc. The one thing I can't do is set the quantity of the item. So the problem at the moment is, I have a lot of one off items. I want t
  12. hi Foxy, if i put: $x = glob('../../_docs/*.*');var_dump($x); the result is: bool(false)
  • Create New...