jmrothermel Posted February 29, 2008 Share Posted February 29, 2008 Here is my code I wrote: <? include("1header.php"); include("members.php"); $a = $_GET['action']; if($a == ''){ $id = $_GET['id']; print "<br><br>Choose if this chinchilla is a breeder or a pet.<br><br><form action='/pet.php?action=set' method='post' enctype='multipart/form-data'> Choose an Option:<br> <select name='status' size='1'> <option value='breeder'>Breeder</option> <option value='pet'>Pet</option> </select> <input type='hidden' name='id' value='$id'> <input type='submit' value=' Set '></form>"; } if($a == 'set'){ $id = $_POST['id']; $pet = $_POST['status']; $update = mysql_query("UPDATE `pets` SET `pet`='$pet' WHERE `id`= '$id'"); if($update) { print "<h2>Your Chinchilla's pet/breeding status has been set. </h2><p> <a href='managepets.php'>Return to your pets</a> "; } else { print mysql_error(); } } include("footer.php"); ?> Any time I click the "set" button it takes me to a page not found 404 Error. Is there something Im not doing right in uploading the page/script? Quote Link to comment Share on other sites More sharing options...
wobbit Posted February 29, 2008 Share Posted February 29, 2008 I don't want to state the obvious but does '/pet.php' exist? Quote Link to comment Share on other sites More sharing options...
tinker Posted February 29, 2008 Share Posted February 29, 2008 This is probably the bit in question: <form action='/pet.php?action=set' ... The first slash means it should be in the root directory of the server. However if it's relative (in same dir) then remove the slash... or does the page exist? (pet.php) Quote Link to comment Share on other sites More sharing options...
jmrothermel Posted February 29, 2008 Author Share Posted February 29, 2008 Wow - thats all it took removing the slash since it was relative in the same directory. Im getting out of this coding business...... Im such an idiot ??? - thanks for the help Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 29, 2008 Share Posted February 29, 2008 Also, if you want to make your code more portable, you can remove pet.php from the action. So this: <form action='?action=set' ... That way if you rename the PHP file later, it won't break the code. Quote Link to comment Share on other sites More sharing options...
tinker Posted February 29, 2008 Share Posted February 29, 2008 you'll pick it up and hey I wasted 4/5 hours yesterday and in the end I had adblock on which was blocking the image, you just gotta laugh. But, I bet you won't forget about the difference between relative and absolute paths (absolute could also have the full http://www.etc.etc/ stuff in front) Quote Link to comment Share on other sites More sharing options...
conker87 Posted February 29, 2008 Share Posted February 29, 2008 you'll pick it up and hey I wasted 4/5 hours yesterday and in the end I had adblock on which was blocking the image, you just gotta laugh. But, I bet you won't forget about the difference between relative and absolute paths (absolute could also have the full http://www.etc.etc/ stuff in front) Oof, ouch, that must have hurt! Quote Link to comment Share on other sites More sharing options...
tinker Posted February 29, 2008 Share Posted February 29, 2008 A silver lining though, i've now been through the regex rules for adblock plus and am about ready to rename the module so that none of my adverts are caught by it. But yeah, wally of the week award! Quote Link to comment Share on other sites More sharing options...
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.