note 88783 added to control-structures.break

From: Date: Sat, 07 Feb 2009 06:03:29 +0000
Subject: note 88783 added to control-structures.break
Groups: php.notes 
Request: Send a blank email to php-notes+get-150360@lists.php.net to get a copy of this message
Ok guys here something that I use and it works <?php switch($_GET['id']) { default: echo "yourvalue\n"; echo "yourvalue2\n"; break; case banner: echo "content in banner\n"; echo "another content in banner\n"; break; case header: echo "content in header\n"; echo "another content in header\n"; break; case other: echo "content in other\n"; echo "another content in other\n"; break; } ?> Now I will explain what each script does. first part the <?php switch($_GET['id']) { should be included or it won't work default is default link, lets say if this is in index.php then when index.php is loaded default will be shown. case banner: or case header: or case other: is what will be hidden until visitors click on link that will take them there, the value after case is going to be added after the name of the file, lets say case banner: is in index.php then case banner: and its contents will be in index.php?id=banner same for header and other cases. note that you always should put break; tag should be included. Hope this helped you guys, I am sorry if i didn't explain it well but I tried my best. ---- Server IP: 69.147.83.197 Probable Submitter: 75.59.177.214 ---- Manual Page -- http://www.php.net/manual/en/control-structures.break.php Edit -- https://master.php.net/note/edit/88783 Del: integrated -- https://master.php.net/note/delete/88783/integrated Del: useless -- https://master.php.net/note/delete/88783/useless Del: bad code -- https://master.php.net/note/delete/88783/bad+code Del: spam -- https://master.php.net/note/delete/88783/spam Del: non-english -- https://master.php.net/note/delete/88783/non-english Del: in docs -- https://master.php.net/note/delete/88783/in+docs Del: other reasons-- https://master.php.net/note/delete/88783 Reject -- https://master.php.net/note/reject/88783 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#150360) next »