Jump to content

Recommended Posts

I have a list of products all in radio buttons, and I use the java script to add and substract the values of each product(radio button)...and when the user clicks on submit I get the category which is a hidden Input, I get the name of the part number wich is the name of the radio button and i also get the price wich is the value of the radio button...

 

Question????.....Is there a way that i can show extra info on my output..like the name of each product I select depending of what product was selected?

 

Or is there another way that i can make my values add and substract using the id instead of the name on the radio buttons??

 

Please help me out I'm about to break my computer apart lol...

 

 

<head>

<script type="text/javascript">

 

function setRadios()

{

function sumRadios()

{

var total = 0, i = 1, oForm = this.form;

while (radgrp = oForm.elements['Parte' + (i++)])

{

j = radgrp.length;

do

if (radgrp[--j].checked)

{

total += Number(radgrp[j].value);

break;

}

while (j);

}

oForm.elements.total.value = total.toFixed(2);

}

 

var i = 0, input, inputs = document.getElementById('f1').getElementsByTagName('input');

while (input = inputs.item(i++))

if (input.name.match(/^Parte\d+$/))

input.onclick = sumRadios;

}

 

onload = setRadios;

 

</script>

</head>

<body>

<form id="f1" method="post" action="confirm.php">

 

<div>

<div id="clear" align="center"><img style="padding-top:30px" src="images/windows-vista.png" name="sistemas" title="sistemas" /></div><br />

<fieldset>

<legend>Sistema Operativo (Set1)</legend>

<input type="hidden" name="Sistema Operativo" />

<div id="clear"><input id="r1" type="radio" name="Parte1" class="Sistema Operativo" value="1733" /><label for="r1">Windows

XP Home <p>(L.1733.00)</p></label></div><br />

<div id="clear"><input id="r2" type="radio" name="Parte1" class="Sistema Operativo" value="2962" /><label for="r2">Windows

XP Profesional <p>(L.2962.00)</p></label></div><br />

</fieldset>

</div>

 

 

<div>

<div id="clear"><img img style="padding-top:30px" src="images/procesador.gif" name="istemas" title="sistemas" /></div><br />

<fieldset>

<legend>Procesadores (Set2)</legend>

<input type="hidden" name="Procesador" />

<div id="clear"><input id="r3" type="radio" name="Parte2" class="Procesador" value="990" /><label for="r3">Procesador

Intel Celeron 420 de 1,6 Ghz <p>(L.990.00)</p></label></div><br />

<div id="clear"><input id="r4" type="radio" name="Parte2" class="Procesador" value="1735" /><label for="r4">Procesador

Pentium IV 3,0 Ghz <p>(L.1735.00)</p></label></div><br />

<div id="clear"><input id="r5" type="radio" name="Parte2" class="Procesador" value="1888" /><label for="r5">Procesador

Intel Pentium Dual Core E2140 1,66 Ghz  <p>(L.1735.00)</p></label></div><br />

<div id="clear"><input id="r6" type="radio" name="Parte2" class="Procesador" value="3180" /><label for="r6">Procesador

Intel Pentium Core 2 DUO E4400 2,0 Ghz  <p>(L.3180)</p></label></div><br />

</fieldset>

</div>

 

 

 

<div id="clear">

<fieldset style="position:relative;top:36px;width:200px;">

Lps<input id="total" type="text" name="total" value="" style="width: 60px" /><strong>

total</strong>  

<br /><input type="reset" style="font-size:11px;" value="Borrar" /><input type="submit" style="font-size:11px;" value="Cotizar" />

</fieldset>

</div>

</div>

</form>

</body>

</html>

 

and this is my output file:

 

<?php

 

if($_GET['continue'] != 1)

{

$name = $_GETT['class'];

 

    // form items you wish to exclude from the info list. you can just make this blank if you dont want to exclude anything

    $exclude = array('submit','hiddenvalue');

 

    foreach($_POST as $class => $val){

   

   

   

        // if its in the exclude array, skip it

        if(in_array($val, $exclude))

            continue;

 

 

        // print out the info

        echo $class.":\t\t ".$val."<br />\n";

    }

 

    ?>

 

Link to comment
https://forums.phpfreaks.com/topic/85728-output/
Share on other sites

Please don't post the same or similar items over and over. Stick to one. This one. When posting code use code tags and only post what's really needed. Too much and people won't bother looking at it. And don't ask for help in someone else's topic...that's just tacky. I've deleted your other posts/topic.

 

Link to comment
https://forums.phpfreaks.com/topic/85728-output/#findComment-437511
Share on other sites

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.