Jump to content

Php Form output Help!!


rhasce

Recommended Posts

Hi I'm trying to create a dell like custom computer and I almost got it done, but i can't fenish because i dont know PHP, well kind of the thing is: when I submit the form, the confirm.php is giving me a set number and the value number, i'm fine with the value number but is it posible to obtain the class number instead of the value..??? pls.... Helpp!!

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

 

<html>

<head>

<title>Arme su computadora!</title>

<style type="text/css">

 

#wrap {

width:600px;

margin-left:150px;

}

 

img {

float:left;

}

 

fieldset {

float:right;

width: 500px;

padding: 5px;

margin-right: 4px;

}

 

input {

float:left;

}

 

label {

float:left;

 

}

 

#clear {

clear:both;

}

 

p {

text-align:center;

height:20PX;

width:150PX;

background-color:silver;

margin-right:0px;

color:red;

float:right;

}

 

legend {

font-weight: bold;

}

#total {

font-size: 11px;

width: 80px;

}

 

 

</style>

<script type="text/javascript">

 

function setRadios()

{

function sumRadios()

{

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

while (radgrp = oForm.elements['Set' + (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(/^Set\d+$/))

input.onclick = sumRadios;

}

 

onload = setRadios;

 

</script>

</head>

<body>

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

<div id="wrap">

<div align="center"><img src="loguito.jpg" ></div>

<fieldset>

<legend>Arme su computadora con Technos Design</legend>

<table style="width: 100%"><tr>

 

<td>

<LABEL style="float:none" for="firstname">Primer Nombre: </LABEL>

</td>

<td>

<INPUT name="Nombre" type="text" id="firstname"></td>

</tr>

<tr>

<td>

<LABEL style="float:none" for="email">Correo Electronico:</LABEL></td>

<td>

<INPUT name="Correo Electronico" type="text" id="email"></td>

</tr>

<tr>

<td>

<LABEL style="float:none" for="phone">Telefono: </LABEL>

</td>

<td>

<INPUT name="Telefono" type="text" id="email"></td>

</tr>

</table>

 

</fieldset>

<span id="clear"></span>

 

<br />

<div>

<img src="images/windows-vista.png" name="sistemas" title="sistemas" /><br />

<fieldset>

<legend>Sistema Operativo</legend>

<input id="r1" type="radio" name="Set1" class="Sistema Operativo" value="1733" /><label for="r1">Windows XP Home <p>(Lps.1733.00)</p></label><br />

<input id="r2" type="radio" name="Set1" class="Sistema Operativo" value="2962" /><label for="r2">Windows XP Profesional <p>(Lps.2962.00)</p></label><br />

</fieldset>

</div>

 

<span id="clear"></span>

<div>

<img src="images/windows-vista.png" name="istemas" title="sistemas" /><br />

<fieldset>

<legend>Procesadores</legend>

<input id="r3" type="radio" name="Set2" class="Procesador" value="990" /><label for="r3">Procesador Intel Celeron 420 de 1,6 Ghz <p>(Lps.990.00)</p></label><br />

<input id="r4" type="radio" name="Set2" class="Procesador" value="1735" /><label for="r4">Procesador Pentium IV 3,0 Ghz <p>(Lps.1735.00)</p></label><br />

<input id="r5" type="radio" name="Set2" class="Procesador" value="1888" /><label for="r5">Procesador Intel Pentium Dual Core E2140 1,66 Ghz <p>(Lps.1735.00)</p></label><br />

<input id="r6" type="radio" name="Set2" class="Procesador" value="3180" /><label for="r6">Procesador Intel Pentium Core 2 DUO E4400 2,0 Ghz <p>(Lps.3180)</p></label><br />

</fieldset>

</div>

 

<span id="clear"></span>

 

 

 

<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>

</form>

</body>

</html>

 

 

 

 

And the Php for my output is this:

 

<?php

 

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

{

// 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 $key => $val)

{

// if its in the exclude array, skip it

if(in_array($val, $exclude))

continue;

 

// print out the info

echo $key.": Lps.".$val."<br />\n";

}

 

?>

<form method="post" action="envia.php">

<br /><br />

 

<li><input type="submit" style="font-size:11px;" value="Terminar" />    <a href="<?=$_SERVER['PHP_SELF']?>?continue=1">Si su informacion esta correcta click aqui.</a></li>

<br />

<li> <a href="javascript:history.go(-1);">Si quiere hacer algun cambio click aqui. (Volver)</a></li>

</form>

 

 

<?

}

 

else

{

// do your "its confirmed code"

// for example, forward the user to a page (uncomment the line):

// header("Location: http://url.com");

}

 

?>

Link to comment
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.