Jump to content

Stripy42

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Stripy42's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This isn't really a problem, it works fine but I wanted to donate my noobie level script because I'm proud of it. Though I would like to make it completely PHP based. The page starts of as English or whatever you want to be default, Clicking on the flag sets a cookie to another language using Javascript which then reloads the page. The language code is set in the variable $lang for whatever PHP to use. It is mostly Javascript not PHP but I've used PHP wherever javascript is stupidly complicated. This bit goes in the header or a separate file to be included <?php $lang = $_COOKIE["language"]; //this sets the cookies' info into a normal variable $extrayear = (date('Y')+2); //sticks 2 years extra life on the cookie as it's not exactly sensitive information echo (" <script type=\"text/javascript\"> function saveLang(lang) { expDate = \"1/01/" . $extrayear . " 00:00:00\" // expiry date document.cookie=\"language=\"+lang+\"; expires=\"+expDate+\";\" //sets cookie window.location.reload() // reloads page } </script> "); ?> This bit goes in the "Body" to choose language, it changes message/image depending on the current language. You could either set these to any other two languages or use a form menu for many languages <?php if ($lang=="jp") { echo ("<a href=\"javascript:saveLang('en')\" > <img src=\"../graphics/flag-uk.gif\" width=\"60\" height=\"40\" alt=\"Set Language to English\" border=\"0\" /></a>"); } else { echo ("<a href=\"javascript:saveLang('jp')\" > <img src=\"../graphics/flag-jp.gif\" width=\"60\" height=\"40\" alt=\"日本語\" border=\"0\" /></a>"); } ?>
  2. I've had just a quick thought, maybe it doesn't like the @ sign or maybe the dots in the email. my sight uses $to = "email@site.com"; $re = "Web Site - Contact Request"; $msg = "<p><b>Contact Request</b></p>"; $msg .= "<p><b>Message received from:</b> " . $name . "</p><p><b>" . "Email to Reply:</b> " . $email . "</p><p>"; $msg .= "<b>Regarding:</b><br /> " . $why . "</p><b>Message:</b><br /> " . $comments . "</p>"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; "; $headers .= "charset=iso-8859-1\r\n"; $headers .= "From: $email \r\n"; mail($to,$re,$msg,$headers); Sometimes using . to join stuff behaves better, and I've also got $headers this might encode the @ sign better.
  3. In the UK the second but of the postcode does need the end numbers sometimes, I think it's when they ran out of numbers. Anyway arrays, I thought I might need them, still haven't quite figured them out yet. I'm going to stick to the IF method for now. And I've found out I do need all of the LE's But just for interest how would I do it, this doesn't work; if ($firstl=="BE" && !($firstn==16 && $secondn==) { // do stuff } Thanks
  4. Hello, I'm making a bit of code that chooses postage cost according to the post code. I've got code that checks if it is valid, then code that splits it up into four parts. $firstl $firstn $secondn $secondl now the problem is that one of the post codes groups required is LE (all except 16.8, 16.9) That means if $firstl == LE then it is ok unless $firstn == 16 and $second == 8 or 9 So I've been using things like ($firstl=="BE" && $firstn==12 && $secondn==7) //to see if ih has to be LE 12.7 ($firstl=="TN" && $firstn>=19 && $firstn<=22) //for things like TN 19 to 22 $firstl=="RH" // for all RH's But I can't figure out a way off doing "all except ..." Any help would be great thanks
  5. Cool, So that will be like an if for each and every link, I can see what you mean about better ways. I was thinking I could get the document name once at the begining, and then compare it for each link to the actual href in the link. That way I won't add an extra chance to create a mistake by haveing to type the link twice.
  6. Hello, I've ben trying to do something really simple but can't find out how. I want to use php to insert the wesites links at the top of every page (easy "include" done that bit) But I want it to not show or gray out the link to the current page. I figured some sort of "if curent site = home.php then "nothing" else echo [code]<a href whatever>stuff</a>[/code] But the actual code needed is evading me. ??? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.