-
Whats wrong with this code.
Thanks everybody soo much for your help. i really appreciate it. this is the final code <?php date_default_timezone_set('GMT'); $date = date('H'); if(!isset($_POST['languages'])) { $_POST['languages'] = array('English'); } foreach ($_POST['languages'] as $language) { switch ($language) { case 'Japanese' : echo "<div id='greeting'>"; if ($date == '00') echo '<h2>おはようございます</h2>'; elseif ($date >= 01 && $date <= 04) echo '<h2>おはようございます</h2>'; elseif ($date >= 05 && $date <= 10) echo '<h2>おはようございます</h2>'; elseif ($date == 11) echo '<h2>正午</h2>'; elseif ($date == 12) echo '<h2>正午</h2>'; elseif ($date >= 13 && $date <= 19) echo '<h2>こんにちは</h2>'; elseif ($date >= 20 && $date <= 23) echo '<h2>こんばんは</h2>'; else ''; echo "</div>"; break; case 'Chinese' : echo "<div id='greeting'>"; if ($date == '00') echo '<h2>早上好</h2>'; elseif ($date >= 01 && $date <= 04) echo '<h2>早上好</h2>'; elseif ($date >= 05 && $date <= 10) echo '<h2>早上好</h2>'; elseif ($date == 11) echo '<h2>午間</h2>'; elseif ($date == 12) echo '<h2>午間</h2>'; elseif ($date >= 13 && $date <= 19) echo '<h2>下午好</h2>'; elseif ($date >= 20 && $date <= 23) echo '<h2>晚安</h2>'; else ''; echo "</div>"; break; default: echo "<div id='greeting'>"; if ($date == '00') echo '<h2>Its a new day! Welcome along and Good Morning.</h2>'; elseif ($date >= 01 && $date <= 04) echo '<h2>Up Early! Good Morning</h2>'; elseif ($date >= 05 && $date <= 10) echo '<h2>Good Morning</h2>'; elseif ($date == 11) echo '<h2>Nearly Midday, What you having for lunch today?</h2>'; elseif ($date == 12) echo '<h2>Its Midday! You had lunch yet? Good Afternoon</h2>'; elseif ($date >= 13 && $date <= 19) echo '<h2>Good Afternoon</h2>'; elseif ($date >= 20 && $date <= 23) echo '<h2>Good Evening</h2>'; else ''; echo "</div>"; break; } } ?>
-
Whats wrong with this code.
Hi guys im taking my exam at christmas soo this is why im starting now cos i gota lot of work to do. this is the new code but still not working. can anyone suggest where to go from here: <?php date_default_timezone_set('GMT'); $date = date('H'); if(!isset($_POST['languages'])) { $_POST['languages'] = array('English'); } foreach ($_POST['languages'] as $language) { switch ($language) { case 'Japanese' : echo ""; break; case 'Chinese' : echo ""; break; default: echo "<div id='greeting'> if ($date == '00') echo '<h2>Its a new day! Welcome along and Good Morning.</h2>'; elseif ($date >= 01 && $date <= 04) echo '<h2>Up Early! Good Morning</h2>'; elseif ($date >= 05 && $date <= 10) echo '<h2>Good Morning</h2>'; elseif ($date == 11) echo '<h2>Nearly Midday, What you having for lunch today?</h2>'; elseif ($date == 12) echo '<h2>Its Midday! You had lunch yet? Good Afternoon</h2>'; elseif ($date >= 13 && $date <= 19) echo '<h2>Good Afternoon</h2>'; elseif ($date >= 20 && $date <= 23) echo '<h2>Good Evening</h2>'; else ''; </div>"; break; } } ?>
-
Whats wrong with this code.
I can't find out/or work out what is wrong with the code below. Please help. Maybe a test of your skills aswell as mine <?php if(!isset($_POST['languages'])) { $_POST['languages'] = array('English'); } foreach ($_POST['languages'] as $language) { switch ($language) { case 'Japanese' : echo ""; break; case 'Chinese' : echo ""; break; default: echo "<span id='greeting'> $date_default_timezone_set('GMT'); $date = date('H'); if ($date == '00') echo '<h2>Its a new day! Welcome along and Good Morning.</h2>'; elseif ($date == '01') echo '<h2>Up Early! Good Morning</h2>'; elseif ($date == '02') echo '<h2>Up Early! Good Morning</h2>'; elseif ($date == '03') echo '<h2>Up Early! Good Morning</h2>'; elseif ($date == '04') echo '<h2>Good Morning</h2>'; elseif ($date == '05') echo '<h2>Good Morning</h2>'; elseif ($date == '06') echo '<h2>Good Morning</h2>'; elseif ($date == '07') echo '<h2>Good Morning</h2>'; elseif ($date == '08') echo '<h2>Good Morning</h2>'; elseif ($date == '09') echo '<h2>Good Morning</h2>'; elseif ($date == '10') echo '<h2>Good Morning</h2>'; elseif ($date == '11') echo '<h2>Nearly Midday, What you having for lunch today?</h2>'; elseif ($date == '12') echo '<h2>Its Midday! You had lunch yet? Good Afternoon</h2>'; elseif ($date == '13') echo '<h2>Good Afternoon</h2>'; elseif ($date == '14') echo '<h2>Good Afternoon</h2>'; elseif ($date == '15') echo '<h2>Good Afternoon</h2>'; elseif ($date == '16') echo '<h2>Good Afternoon</h2>'; elseif ($date == '17') echo '<h2>Good Afternoon</h2>'; elseif ($date == '18') echo '<h2>Good Afternoon</h2>'; elseif ($date == '19') echo '<h2>Good Afternoon</h2>'; elseif ($date == '20') echo '<h2>Good Evening</h2>'; elseif ($date == '21') echo '<h2>Good Evening</h2>'; elseif ($date == '22') echo '<h2>Good Evening</h2>'; elseif ($date == '23') echo '<h2>Good Evening</h2>'; else ''; </span>"; break; } } ?>
-
Warning: Invalid argument supplied for foreach()
WOW, thankyou sooo much, this was brilliant worked perfectly. its exactly what i needed? soo what was the exact problem that you found? so i kno for next time? thanks soo much. i really appreciate this.
-
Warning: Invalid argument supplied for foreach()
- Warning: Invalid argument supplied for foreach()
can anybody take a look at my code and tell me where i am going wrong? the error is: Warning: Invalid argument supplied for foreach() in /home/ryanmur1/public_html/uni/index.php on line 162 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Loughborough University | Students Union</title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <div id="header"> <img src="images/logo.png" /> <span id="greeting"> <?php date_default_timezone_set('GMT'); $date = date('H'); if ($date == "00") echo "<h2>It's a new day! Welcome along and Good Morning.</h2>"; elseif ($date == "01") echo "<h2>Up Early! Good Morning</h2>"; elseif ($date == "02") echo "<h2>Up Early! Good Morning</h2>"; elseif ($date == "03") echo "<h2>Up Early! Good Morning</h2>"; elseif ($date == "04") echo "<h2>Good Morning</h2>"; elseif ($date == "05") echo "<h2>Good Morning</h2>"; elseif ($date == "06") echo "<h2>Good Morning</h2>"; elseif ($date == "07") echo "<h2>Good Morning</h2>"; elseif ($date == "08") echo "<h2>Good Morning</h2>"; elseif ($date == "09") echo "<h2>Good Morning</h2>"; elseif ($date == "10") echo "<h2>Good Morning</h2>"; elseif ($date == "11") echo "<h2>Nearly Midday, What you having for lunch today?</h2>"; elseif ($date == "12") echo "<h2>Its Midday! You had lunch yet? Good Afternoon</h2>"; elseif ($date == "13") echo "<h2>Good Afternoon</h2>"; elseif ($date == "14") echo "<h2>Good Afternoon</h2>"; elseif ($date == "15") echo "<h2>Good Afternoon</h2>"; elseif ($date == "16") echo "<h2>Good Afternoon</h2>"; elseif ($date == "17") echo "<h2>Good Afternoon</h2>"; elseif ($date == "18") echo "<h2>Good Afternoon</h2>"; elseif ($date == "19") echo "<h2>Good Afternoon</h2>"; elseif ($date == "20") echo "<h2>Good Evening</h2>"; elseif ($date == "21") echo "<h2>Good Evening</h2>"; elseif ($date == "22") echo "<h2>Good Evening</h2>"; elseif ($date == "23") echo "<h2>Good Evening</h2>"; else ""; ?> </span> </div> <ul id="menu" style="margin-left:-25px;"> <li><a href="">Home</a></li> <li><a href="">Your Union</a></li> <li><a href="">Halls</a></li> <li><a href="">Sport</a></li> <li><a href="">International</a></li> <li><a href="">The Uni</a></li> <li><a href="">Contact Us</a></li> <li><a href="">Events</a></li> <li><a href="">Get Involved</a></li> <li><a href="">Links</a></li> </ul> <div id="line"></div> <div id="welcome_pic"><div id="play_feature"><font class="play_feature">Demonstration Play Feature</font> <br /> <br /> <div id="your_details"> <font class="play_feature_sub_heading">Your Details</font><br /><br /> <?php /* This file is free software: you can redistribute it and/or modify the code under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. However, the license header, copyright and author credits must not be modified in any form and always be displayed. This class is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @author geoPlugin (gp_support@geoplugin.com) @copyright Copyright geoPlugin (gp_support@geoplugin.com) This file is an example PHP file of the geoplugin class to geolocate IP addresses using the free PHP Webservices of http://www.geoplugin.com/ */ require_once('geoplugin.class.php'); $geoplugin = new geoPlugin(); $geoplugin->locate(); echo "Your IP address is: {$geoplugin->ip} <br />\n". "City: {$geoplugin->city} <br />\n". "Region: {$geoplugin->region} <br />\n". "Country Name: {$geoplugin->countryName} <br />\n". "Country Code: {$geoplugin->countryCode} <br />\n"; ?></div> <div id="your_details"><font class="play_feature_sub_heading">Factoid</font><p>At its zenith in the 19th century, <br />the British Empire stretched over<br> one-fourth of the earth's surface.</p></div> <div id="change_settings"> <font class="play_feature_sub_heading">Change Settings</font><br /><br /> <form method="post" style="margin-left:-5px;"> <p> Select your Language </p><p> <label> <input name="languages[]" type="radio" value="English"/> English </label> <label> <input type="radio" name="languages[]" value="Japanese" /> Japanese </label><label> <input type="radio" name="languages[]" value="Chinese" /> Chinese </label> <br /><br /> <input type="submit" value="Send" name="poll" /> </p></form></div> <div id="flag_counter"> <font class="play_feature_sub_heading">Flag Counter</font><br /><br /> <a href="http://s06.flagcounter.com/more/7ydE"><img src="http://s06.flagcounter.com/count/7ydE/bg=FFFFFF/txt=000000/border=CCCCCC/columns=2/maxflags=25/viewers=Visitors/labels=0/pageviews=1/" alt="free counters"></a></div></div></div> <div id="homepage_text"> <?php foreach ($_POST['languages'] as $language) { switch ($language) { case 'English' : echo "<p>Welcome to the Loughborough Students Union, the second home for most of the students at Loughborough University. Browse around the website for anymore information and don't hesitate to use the contact form.</p><p>Please make full use of the 'Demonstration Play Feature' to maximise your experience from this website. Change the language to see what happens or for the obvious need that you might not speak english or you can view from different dates or locations. </p><p>Another useful feature is the 'factoid' feature where you can see different facts depending on the location, language and date you have chosen.</p>"; break; case 'Japanese' : echo "<p>ようこそラフバラ学生連合には、ラフバラ大学では学生の大半は第2の故郷。のためのウェブサイトで、もはや、情報閲覧、お問い合わせフォームを使用することを躊躇しないでください。</p> <p>してくださいの'デモ再生機能'は、このウェブサイトからあなたの経験を最大限に活用する。何が起こるのか、明らかに必要がある場合英語を話すことがありますか、または別の日程や場所から見ることができます参照してくださいに使用する言語を変更します。</p> <p>別の便利な機能がある場合は、場所、言語、および、選択した日付に応じて異なる事実を見ることができる'疑似事実'の機能です。</p>"; break; case 'Chinese' : echo "<p>歡迎拉夫堡學生會的第二個家的大部分學生在拉夫堡大學。瀏覽網頁,供各地的信息和再不要猶豫,使用聯繫表格。</p> <p>請充分利用示範播放功能'您的經驗,盡量從這個網站。更改語言來看看會發生什麼,或明顯的需要,您可能不會講英語,也可以從不同的日期或地點。</p> <p>另一個有用的特點是,功能,您可以看到不同的事實而定地點,語言和日期您所選擇。</p>"; break; default: echo "<p>Welcome to the Loughborough Students Union, the second home for most of the students at Loughborough University. Browse around the website for anymore information and don't hesitate to use the contact form.</p><p>Please make full use of the 'Demonstration Play Feature' to maximise your experience from this website. Change the language to see what happens or for the obvious need that you might not speak english or you can view from different dates or locations. </p><p>Another useful feature is the 'factoid' feature where you can see different facts depending on the location, language and date you have chosen.</p>"; } } ?> </div> <table> <tr><td class="news_events">News</td><td class="news_events">Events</td></tr> <tr><td class="news_events_bullets"><ul><li>News Item 1</li><li>News Item 2</li><li>News Item 3</li></ul></td><td class="news_events_bullets"><ul><li>News Item 1</li><li>News Item 2</li><li>News Item 3</li></ul></td></tr> </table> </div> </body> </html> would be much appreciated , cheers guysRyanMurphy started following Server Side- Changing the language of a webpage.
For my final year university project, i need to know how do i change to language of my webpage without linking to another page. so basically i want to have a drop down menu, with a few languages on it, i.e. french, italian and chinese, and when the user selects on of these languages the content on the page changes to the selected language? does anybody have any idea how to do this? Thanks Guys- Display different content at different times of the day
thanks for your help. no im not looking for someone to write the code. im just doing a bit of practising before i partake on my ZEND qualification im doing in april- Display different content at different times of the day
yer thanks for that, if else is probably a good option to be honest. I was thinking of having several different responses stored somewhere and somehow using coding recall them from a database or something but im not quite sure.- Display different content at different times of the day
What I need help with is I want to display different content at different times of the day, without having to do it manually myself ever other hour. So lets say for example i wanted to show 'Good Morning' at 8AM and 'Good Night' at 8PM, and for this to happen automatically. Does anyone know how to do this? Or point me to any websites/tutorials/advice/examples that may help? Thanks- Funniest Blog The world has ever seen. Must Read - Hilarious
Basically, I was looking around for guest bloggers for my my website and I eventually went to Yahoo Answers. I went to the leader board and saw this guy with the alias Stephen K and he was streaks ahead. I sent him a personal message asking him to write a guest blog for me. You would of thought he would write a blog about how to get ahead in Yahoo Answers ranking right? WRONG. The result was a blog that was a better read than anything i could of possibly hoped for. He wrote a blog about how much he loves to be Ariel from 'The Little Mermaid' and has collected everything spent a fortune on collecting dolls of her, This is the link to the blog Click Here To View The Blog I think he is serious. I just wanted to see if you guys thought this was as funny as I did and if you think he is being serious aswell?? Seriously Guys this is hilarious. Just thought i would share it with you.- Seo Optimisation Tips for My Personal Website
i agree, i want to rank for the term ryan murphy, but other keywords wouldnt hurt. i kno i have to sort my site out seo wise but i dont know how, and everything i read confuses me, can anyone look at my site and tell me the ten things i must do in order to get myself started?- Seo Optimisation Tips for My Personal Website
Thanks for the advice il check them out and let u know what i think. Have you or anybody else got any general tips, sort of like a top ten must dos for SEO optimisation.?- Seo Optimisation Tips for My Personal Website
I have just built my University Finaly year project Website www.ryanmurphy.org.uk. I want to rank in highly in google for the term 'Ryan Murphy', which is my name. Can anyone take a look and give me some advice on how to Optimise this website in terms of SEO so i can rank for the term 'Ryan Murphy' Thanks for any help Ryan Murphy Computing and Management Student Loughborough University www.ryanmurphy.org.uk - Warning: Invalid argument supplied for foreach()