PDA

View Full Version : problem with my shop-script


a|landargin
02-09-2003, 06:57 PM
hi,

i got the problem, that my shop-script does not hand over the data concerning the "chosen items" correctly to the send-php-script.

it hands over just the last line of the value, i.e. the last item.

the cause may be that there is only one function for all lines of the function. it types the "basket- list" line-by-line.

is it possible to put the whole list into one value on one "name" that can be handed over to the php-send-script?

i'll post the core of the end of the shop script now, sorry for not usable data, i'm not very experienced..:
---------------------------------------------------

<script language="JavaScript">
<!--
if (sArt.length>0)
{
for (sArti=0; sArti<sArt.length; sArti++)
{
document.writeln('<input type="hidden" name="Artikel" value="'+sArt[sArti]+'">');
}
}
// -->



<!--
var gtotal=6.70;
function getBetr(b)
{
k = (Math.round(100 * (b + 0.00001)) / 100 + 0.001) + '';
k = k.substring(0, k.indexOf('.') + 3);
return k;
}
function putsArt(s)
{
if (s=='')
return false;
a=s.split(';');
aAnz=a[0];
aNr=a[1];
aTitel=a[2];
aPreis=a[3];
gtotal=gtotal+(Number(aAnz)*Number(aPreis));
document.writeln('<tr>');
document.writeln(' <td width="13%" valign="top">'+aAnz+'</td>');
document.writeln(' <td width="13%" valign="top">'+aNr+'</td>');
document.writeln(' <td width="44%" valign="top">'+aTitel+'</td>');
document.writeln(' <td width="15%" align="right" valign="top">'+aPreis+'</td>');
document.writeln(' <td width="13%" align="right" valign="top">'+getBetr(aAnz*aPreis)+'</td>');
document.writeln('</tr>');
}

------------------------------------------------------------------------

ok, the problem is that "artikel" has always only the value of a single line...

i need a value that contains every line.

i say thank you now for the time youre spending on reading this, i hope i described the problems so that you understand them =) as i said im not very experienced.

a|landargin

Philip M
02-09-2003, 08:54 PM
<script language="JavaScript">
<!--
var temp="";
if (sArt.length>0)
{
for (sArti=0; sArti<sArt.length; sArti++)
{
temp=temp+sArt[sArti]+'>';
}
document.writeln('<input type="hidden" name="Artikel" value=temp);
}
</script>

a|landargin
02-09-2003, 10:12 PM
document.writeln('<input type="hidden" name="Artikel" value=temp>');

gives me the word temp.. how do i call a variable so i get its value?

sorry for my stupid question..

a|landargin
02-09-2003, 10:49 PM
k i guess it's "'+temp+'" thx
philipm.. he's my hero =)))