Jump to content

Problems with moving data from one case' ': to over


messer

Recommended Posts

Hi to everyone, I'm a novice in php,and currently working in php4.

I got a problem :-[ and can not find solution. Please to help me to solve it... :'(

Here is the code:

<?php
session_start();

include("dbinfo.php");

if(!isset($_GET['action'])) $_GET['action']='';
switch($_GET['action'])
{
case '':

$_SESSION['bonid']=$_GET['bonid'];
$_SESSION['numer']=$_GET['numer'];

$query="SELECT * FROM bon  WHERE BonID='".$Row['ID']."'"; // $Row['ID'] from another select
$result_bon=mysql_query($query);

echo' <form name="form1" method="post" action="this_page.php?action=update&id='.$_SESSION['bonid'].'" enctype="multipart/form-data">

       <table width=100% border=0 cellpadding=1 cellspacing=1 bgcolor="#ffffff">';

while($Row_bon=mysql_fetch_array($result_bon)) {
				$i++;
				$query_art="SELECT * FROM artikles  WHERE ArtID='".$Row_bon['ArtikleID']."'";
				$result_art=mysql_query($query_art);
				$Row_art=mysql_fetch_array($result_art);

			echo '<tr>
					<td class="xxx" >'.$i.'</td>
					<td class="xxx" ><input name="art[]" type="checkbox" value='.$Row_art['ArtID'].'></td>
					<td class="xxx" >'.$Row_art['ArtNumer'].'</td>
					<td class="xxx" >'.$Row_art['ArtDescription'].'</td>
					<td class="xxx" ><input name="total[]" type="text" value='.$Row_bon['ArtTotaal'].' size=6></td>
					<td class="xxx" >&#8364; '.$Row_bon['ArtPrice'].'</td>
					<td class="xxx" >'.$Row_bon['ArtBTW'].'%</td>
					<input name="price[]" type="hidden" value='.$Row_bon['ArtPrice'].'> //Here i putted two hidden inputs to be able to move the value(price and btw) from this case to next one
					<input name="btw[]" type="hidden" value='.$Row_bon['ArtBTW'].'>
					</tr>';
					}

			echo'</table> </br>
		<div align="center"><input name="submit" type="submit" value=" Next " /><div>
</form>';
break;
case 'update':

if(!isset($_POST['total'])) $_SESSION['total'] = '';
else $_SESSION['total'] = $_POST['total'];

if(!isset($_POST['art'])) $_SESSION['art'] = '';
else $_SESSION['art'] = $_POST['art'];

if(!isset($_POST['price'])) $_SESSION['price'] = '';
else $_SESSION['price'] = $_POST['price'];

if(!isset($_POST['btw'])) $_SESSION['btw'] = '';
else $_SESSION['btw'] = $_POST['btw'];

$_SESSION['bonid']=$_GET['id'];
$_SESSION['numer']=$_GET['numer'];

 

.... And here is my problem, I have in previous case at least 5-6 rows with different artikles and inputs with price, and i check for example only the 1st and 4th artikle, and don't know how to get all those values that from row 1 and 4 (a checkbox and inputs ... I'm sorry for my English, and i would appreciate if anyone could help me.

I'm generating a table, with more than 5 rows, each row contains a checkbooks, and 3-4 <input>, and for example:

- i want to check only row 1 and 3; when i press next its generating another table with values from checkbox 1 and 3(everything it's fine),but values from <input> 1 and 2...

now you understand my problem?

everything it's working... the problem is that when i press NEXT in the over case' ': are formatted 6 arrays:

from "checkbox" :

- $_session['var'][0](id from first row) and [1](id from the 3rd row) ((because i've selected only 2 checkboxes))

but from the rest :

-$_session['var+'][0] (id from first row)

-$_session['var+'] [1] (id from second row)

-$_session['var+'][2]

-$_session['var+'][3]

-$_session['var+'][4]

 

I've tried " foreach" and it doesn't arrange correctly

 

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.