jon182 Posted April 4, 2009 Posted April 4, 2009 ok. i'm scripting a page and have a few problems. 1. It says that the scrpit requires an action when it has the following action. <form action='police_investigation.php?action=policeisub' method='post'> and at the begining of the scrpit i have. case 'policeisub': police_investigation_submit(); break; 2. Even though i have used the print code within a function none of the stuff i'm supposed to print shows up. why is this? Quote
DELETE ME NOW! Posted April 4, 2009 Posted April 4, 2009 Re: this scrpit requires an action Ya here is an example... switch($_GET['action']) { case "one" : blah_one(); break; case "two" : blah_two(); break; default : echo 'This script requires an action'; break; } function blah_one() { echo 'Blah one'; } function blah_two() { echo 'Blah two'; } Now to access it you would do. [url="scriptname.php?action=one"]Action one[/url] [url="scriptname.php?action=two"]Action two[/url] See if you under stand that. Where is the one, two coming from? case "blah" : blah_one(); break; ^ name here ^ function name here Quote
jon182 Posted April 4, 2009 Author Posted April 4, 2009 Re: this scrpit requires an action thats exactly what i have except for instead of " i use ' and instead of "echo" i use "print" and instead of Action one i use <form action='filename.php?action=one' method='post'> then i use a dropbox (which doesn't show up) then i use <input type='submit' value='button name' /></form>"; Quote
Floydian Posted April 4, 2009 Posted April 4, 2009 Re: this scrpit requires an action Just for shts and giggles, have you tried replacing switch($_GET['action']) with switch($_REQUEST['action']) ?hope that helps... Quote
jon182 Posted April 4, 2009 Author Posted April 4, 2009 Re: this scrpit requires an action it didn't change anything Quote
Floydian Posted April 4, 2009 Posted April 4, 2009 Re: this scrpit requires an action Try doing a var_dump($_REQUEST['action']; and see what that outputs. Quote
AlabamaHit Posted April 4, 2009 Posted April 4, 2009 Re: this scrpit requires an action Your making it say that...with the Default switch sounds like you took it from a staff page cuase thats what they do if you go straight to the page it says that. You need to set a default for the apge. Quote
jon182 Posted April 4, 2009 Author Posted April 4, 2009 Re: this scrpit requires an action i set that but if i don't set that defualt then the page would be blank. Quote
jon182 Posted April 4, 2009 Author Posted April 4, 2009 Re: this scrpit requires an action thanks alabama i solved it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.