Seaholme Posted July 30, 2010 Share Posted July 30, 2010 Hey there, Basically I'm having some difficulty getting this form to work: <form action=getitem.php method=post name=form2><input type=hidden name=itemid value='1'> <input type=image src=items/ricketyoldsledge.png name=free class=img></form> It'll work if it's at the top of the code for the page I want it on, however I want it to be in a later position (I've included the PHP for the whole page below, so hopefully you can see what I mean). The error I get is that the form appears to send, only instead of sending me to getitem.php it just goes back to sledmakers.php. <?php include('connect.php'); include('header.php'); include('loggedin.php'); echo 'blah blah"'; // Check profession $result = mysql_query("SELECT * FROM players WHERE id=".$_SESSION['id']) or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $profession = $row['profession']; $level = $row['level'];} // if they're unemployed still if($profession == 'Unemployed'){ echo '<br><br><form action=sledmakers.php?talk=yes method=post name=form1> <input type=submit name=submit value="Talk to the man?"><bR><Br>'; } // if they're a Sledmaker elseif($profession == 'Sledmaker'){ echo 'Sledmaker';} // if they're not a Sledmaker else{ echo 'What? You\'re not a Sledmaker! Go away.';} $talk = $_GET['talk']; // if they're unemployed and pressed to speak with her if($talk == 'yes') { echo 'blahblah'; echo 'You look in the corner and find what you\'re looking for...<bR><br>'; ?> <form action=getitem.php method=post name=form2><input type=hidden name=itemid value='1'><input type=image src=items/ricketyoldsledge.png name=free class=img></form> <br><br><form action=sledmakers.php method=post name=form3> <input type=submit name=submit2 value="Become the Master Sledmakers's Apprentice?"><bR><Br> <?php } else{ echo '';} if(isset($_POST['submit2'])){ echo 'You are now an Apprentice Sledmaker!'; } include('footer.php'); ?> Can anybody help me out? :/ If you need more info, please just ask! Quote Link to comment https://forums.phpfreaks.com/topic/209374-form-not-working/ Share on other sites More sharing options...
wildteen88 Posted July 30, 2010 Share Posted July 30, 2010 You have invalid HTML in two places (lines 24 and 52). You have left of the closing form tag (</form>). This may be why your forms are not behaving as you are expecting them to. Quote Link to comment https://forums.phpfreaks.com/topic/209374-form-not-working/#findComment-1093262 Share on other sites More sharing options...
Seaholme Posted July 30, 2010 Author Share Posted July 30, 2010 Whyyy do the simple things hide from me?! You wouldn't believe how long I've spent trying to figure it out when the answer should've smacked me in the face. Ach! Thanks so so much! Quote Link to comment https://forums.phpfreaks.com/topic/209374-form-not-working/#findComment-1093265 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.