Jump to content

Recommended Posts

Sorry for all the posts today, coming to the end of my project (i hope) :)

 

I can't get a basic form submit to work!

 

FORM CODE

		
<?	while ($row=mysql_fetch_assoc($result3)) { ?>
<tr>
	<form action="/cart.php" method="post" id="mycart">
		<td id="normal"><object id='cart_pkg' name="cart_pkg"><? echo $row['packaging_desc']; ?></object></td>
		<td id="normal"><object id='cart_msg' name="cart_msg"><? echo $row['packaging_message']; ?></object></td>
		<td id="normal" align="center"><object id='cart_qty' name="cart_qty"><? echo $row['packaging_quantity']; ?></object></td>
		<td id="normal" align="center"><object id='cart_cello' name="cart_cello"><? echo $row['packaging_cello']; ?></object></td>
		<td id="normal" align="center">£<object id='cart_prc' name="cart_prc"><? echo number_format($row['packaging_price'],2,'.',''); ?></object></td>
		<td id="normal"><input name="qty" type="text" id="qty" size="3" /></td>
		<td id="normal"><input type="submit" value="Go!" id="submit5" name="submit5"></td>
	</form>
</tr>
<? } ?>

 

PROCESSING CODE


if ($_POST['submit5']) {
$_SESSION['test']="abc";
} else {
$_SESSION['test']="222";
}

 

I then output $_SESSION['test'] to /cart.php and it always comes out as 222. So the form is not getting POSTed. I've tried with a submit button instead of an image. I've tried calling the submit "submit5" and referencing that instead of the whole form (mycart).

 

My only thought is that the multiple submits (one per line of the table) is screwing things up... or I'm doing something stupid...

 

Grateful for any help

Emma

i don't know what cart.php or bulkview.php are!

 

i assume

 

 if ($_POST['submit5']) {
$_SESSION['test']="abc";
} else {
$_SESSION['test']="222";
}

is in cart.php! in which case you should of changed it to

print_r($_POST);
if ($_POST['submit5']) {
$_SESSION['test']="abc";
} else {
$_SESSION['test']="222";
}

 

OK, sorry.

 

So, does:

Array ( [qty] => 2 [submit5] => go! )

 

mean anything to you? (I changed the form action to go to itself, and this is what I got: qty is the input field in the form, go! is the value of the submit).

 

I'm figuring:

1) None of the form "objects" have any values in this posted array (I was hoping that cart_pkg and all the other objects would have values stored here

2) POST is clearly working in some capacity, so why isn't it triggering if ( $_POST['submit5'] ) ?

 

ARGH!

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.