Jump to content

ramzess

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ramzess's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you Barand. Thank you. Oh yes, from now on I will work with register_globals Off to escape such situations when you suddenly find something is not working somewhere. Thank you.
  2. Hi guys! I just found out that my code for changing contents of a table cell is not working on some servers. Later I found out why - it is because 'register_globals'  in php.ini is Off. On ones I tried this simple script it was On. This is my simple code. Sure now way to make it even more simple. But What can I do about it? How can I define this variable $cng? If I define it a value script stops working. :( I can't believe - it should be so common to use this one, please, is there really no way out? [code]<?php switch ($cng) { case "1"; require ('content/page1.php'); break; case "2"; require ('content/page2.php'); break; default; require ('content/page0.php'); } ?>[/code] Of course, links for calling in those pages is like: <a href="?cng=1">Page 1</a> and <a href="?cng=2">Page 2</a> Is there a solution? Thank you.
  3. So what you are saying is that there is no way to refresh page usinh php code so user don't have to press F5? I can't believe it. So where is the point in using cookies for matter I have? No point? :(
  4. Hi guys! I have a page (lets say index.php) where user choose language On very top of it there is such php code: [code] <?php if ( $_COOKIE['langSet'] == 'english') header("Location: http://www.mysite1.com"); elseif ( $_COOKIE['langSet'] == 'german') header("Location: http://www.mysite2.com"); ?> [/code] If choosing, for example, english, he would be sent to www.mysite1.com/main.php where on very top is a code: [code] <?php $lang = 'english'; setcookie("langSet", $lang, time() + (86400*30), "/"); ?> [/code] Idea is that next time user goes to the page where he must choose language, he is redirected to the appropriate one he choose before. Problems: 1) How do I make cookie not to dissapear after browser is closed? 2) How do I make possibility for user to still be able to go back to language selection page after he choose language and the cookie is set? By now I have made a 'middle' page where cookie is unset after what user gets redirected to language selection page. Is there another way? 3) How do I refresh the page which sets the cookie, so it's value can be used immediately? Oh please... I am googling around trying to find answers, but can't find a solution on this one.. at least one that works :( Thank you guys in advance!
  5. Could at least somebody please show me how you must write this expression with $_GET? What is this variable I should send back to homepage? How? I believe on homepage these should be something like if isset $_GET and it's value then something happens.. but how.. :(
  6. [quote author=mb81 link=topic=104373.msg416290#msg416290 date=1155660224] I would say this is more of a site design thing, but if you are looking for the php answer, here it is: Send a variable via GET in your request back to the homepage that designates that you are going to set the language On the homepage, check for that GET variable before redirecting anywhere. Typically, language change items are on every page, so like I said, this can also be fixed by designing a better UI and flow for your site. [/quote] Thank you in advance. Hm... Thank you very much. Though I am not so sure on how to do that. Let's say I have a link on some of those language pages (let's say 'mainENG.php'), sending user back to main page. Ok? So where do I define this variable I have to send via GET? On the same page? Like: $noredirect vhat would be the value of it? and where would I put this GET? And how can I check for the GET variable on the language selection page, if code: <?phpif ( $_COOKIE['LangCookie'] == eng) header("Location: lv.php"); elseif ( $_COOKIE['LangCookie'] == ger) header("Location: ru.php"); ?> is on thee very top of that page above <HTML> tag? Sorry, I must be stupid and sound just as annoying as all others who just start to get familiar with PHP. :(
  7. Sorry guys, it probably is funny.... not to me though I have a very simple page based on html/css and some minor php first page (lets say: www.name.com/index.php) contains simple text links (language selection). On top of it there is such php code: <?php if ( $_COOKIE['LangCookie'] == eng) header("Location: lv.php"); elseif ( $_COOKIE['LangCookie'] == ger) header("Location: ru.php"); ?> User selects link (representing his language) and gets to www.name.com/eng/index.php where a cookie is written: <?php $language = 'eng'; setcookie("LangCookie", $language, time()+60); ?> Well I know that current time is set to 60sec's... that's for testing purposes... [b]Here is the problem:[/b] IF user has selected wrong language, and wants to get back to main page (language selection page), he cant, because php code at the start of it checks the cookie content and sends him back to page he selected first time, unless cookie has expired or is deleted from PC. Guys, IS there a possibility to get back to main page to reselect the language? Please, please, please...  :'(
  8. Well thank you very much for being so welcome and helpful. I believe for you it is nothing for me it is my first try in PHP and making my own website! Thank you!
  9. Wow... that is just great, you guys are great. Thanks GingerRobot! I did copy it from the site, step by step, excluding comments and everything, and it works now! well... not the way I want, but at least it generates the contents of menu and does not give me this error. now I got to unbderstand what this // define our current location $current_url = $_SERVER['PHP_SELF']; and // tabindex is set to "2" here, because my "skiplink" is set as "1" // more information on a skiplink can be found at // http://www.wac.ohio-state.edu/tutorials/section508/skipnav.htm // more information on tabindex can be found at // http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex $tabindex = 2; does. should I leave this PHP_SELF as it is, or I must change it to something? and tabindex? does it indexes my menu items for when I use TAB key on kyeboard?
  10. Here is a good example of what I am trying to achieve: http://www.asma.org/ this is how I am trying to make my navigation panel work... I know how to make it work like that putting this control panel contents in every single page of my site, but what I want to do is to put it in only one file and then to be called in by php... :(
  11. Yes.. unfortunately... :( maybe there is some problem in php configuration (php.ini) or maybe this code I took from the address above, (where everything is explained in comments on how to make it work), is not supposed to be working on Windows system?
  12. Or maybe, if there is another way out of this problem (not using this script) you guys could help me with that. I don't know what to do. Thank you.
  13. Well unfortunately it gives me the same error. Now I even placed original, unchanged PHP script but it does not work. Complains about the same thing. It is so bad I don't know how to make my own script yet... all I want is a vertical menu included in every page on my site where menu itself resides in a single file, so if I might change something in future, I don't need to change through every single file. And that is what I know how to make very well. Reason I am messing with this code is that I would like the menu item (link) become styled by CSS when the page it points to is currently open. By styling I mean changing background color of the active item. And this wonderful code from http://karlcore.com/programming/dynav/ seemed to be the best solution, but now I am desperate. :( Re $_SERVER['index1.php'] originally there was // define our current location $current_url = $_SERVER['PHP_SELF'];
  14. Greetings guys! I'm stuck with it just because I simply don't know PHP. Learning. I took this code from karlcore.com (thanks to it's author), I followed the instructions, bet all I get is: Parse error: parse error, unexpected T_STRING in C:\Program Files\TSW\Apache2\htdocs\EIC\menu1.php on line 3 I am working and testing this under Windows XP. Here is the code: <?php $nav_options = array( "Home" => "/index.php", "Blog" => "/blog/index.php",  "News" => "/news/index.php", "Resume" => "/resume/index.php", "Past Work" => "/portfolio/index.php", "Articles" => "/articles/index.php", "Downloads" => "/programming/index.php", "Links" => "/links/index.php" ); $current_url = $_SERVER['index1.php'];  print("<!-- begin menu include --> <div id=\"navigation\">\n  <ul id=\"navigation\">\n"); $tabindex = 2; foreach($nav_options as $key => $val){ if($val != $current_url){ print("<li><a href=\"$val\" tabindex=\"$tabindex\">$key</a> </li>"); $tabindex++; } else{ print("<li class=\"curr_loc\">$key</li>"); } }  print("</ul>"); print("</div><!-- end menu include -->"); ?> As I checked the forum prior the posting my problem in here, it seemed that most common problem in this case is missing semicolumn. Well here I can't see them missing. :( Thank you guys in advance.
×
×
  • 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.