Jump to content

Form not working...


Seaholme

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/209374-form-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.