Jump to content

Form confirmation help!


rhasce

Recommended Posts

Hi let me try this again, I have a group of products which you can select from a list, and when the user clicks submit my action is on confirm.php, and  I'm really new to php so my question is: Is it possible to to show the name of the selected product next to the price shown in the confirmation page? also how can i validate if the user checked all of the radio buttons I have? And why won't it send me an e-mail then I submit? Also i know css well so how can I apply css to my output

 

 

 

 

<!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:779px;

 

}

 

img {

border-bottom-color:blue;

float:left;

margin-left:80px;

}

 

fieldset {

float:right;

width: 500px;

padding: 5px;

margin-right: 4px;

}

 

input {

float:left;

}

 

label {

float:left;

font-family:Arial;

font-size:medium;

 

 

}

 

#clear {

clear:both;

}

 

p {

text-align:center;

font-weight:bold;

height:20PX;

width:150PX;

background-color:#E3E3D7;

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

<div id="wrap">

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

 

<div >  <img src="images/baner.png"> </div>

<fieldset>

<legend>Arme su computadora</legend>

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

 

<td>

    <LABEL style="float:none" for="firstname">Nombre Y Apellido: </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="telefono"></td>

</tr>

</table>

 

    </fieldset>

  <div style="float:right;width:500px;padding:5px;margin-right:4px;text-align:center" id="clear">

Instrucciones:Puedes armar tu computadora simplemente selecciona cada una las partes de tu

preferencia.</div>

 

<br />

<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>(Lps.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>(Lps.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>(Lps.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>(Lps.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>(Lps.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>(Lps.3180)</p></label></div><br />

</fieldset>

</div>

 

 

<div>

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

<fieldset>

<legend>Disco Duro (Set3)</legend>

<input type="hidden" name="Disco Duro" />

<div id="clear"><input id="r7" type="radio" name="Parte3" class="Disco Duro" value="1007" /><label for="r7">Disco

80 GB  <p>(Lps.1007.00)</p></label></div><br />

<div id="clear"><input id="r8" type="radio" name="Parte3" class="Disco Duro" value="1219" /><label for="r8">Disco

Duro 160 GB - ide  <p>(Lps.1219.00)</p></label></div><br />

<div id="clear"><input id="r9" type="radio" name="Parte3" class="Disco Duro" value="1338" /><label for="r9">Disco

Duro 160 GB - sata 2  <p>(Lps.1338.00)</p></label></div><br />

<div id="clear"><input id="r10" type="radio" name="Parte3" class="Disco Duro" value="1555" /><label for="r10">Disco

Duro 250GB - ide  <p>(Lps.1555)</p></label></div><br />

<div id="clear"><input id="r11" type="radio" name="Parte3" class="Disco Duro" value="2144" /><label for="r11">Disco

Duro 320GB - sata  <p>(Lps.2144.00)</p></label></div><br />

<div id="clear"><input id="r12" type="radio" name="Parte3" class="Disco Duro" value="1860" /><label for="r12">Disco

Duro 250GB SATA  <p>(Lps.1860)</p></label></div><br />

<div id="clear"><input id="r13" type="radio" name="Parte3" class="Disco Duro" value="3492" /><label for="r13">Disco

Duro 400GB IDE  <p>(Lps.3492)</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 confirm.php *****************************

 

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

 

<head>

<style type="text/css">

.direccion {

text-align: center;

}

.direccion {

font-family: Arial;

}

</style>

</head>

 

<img src="loguito.jpg" /><div style="float:right;width:400px"><a href="#" onclick="java script:window.print(); return false">Imprimir</a></div> <br /> <br />

<div style="width:600px;text-align:center;border-color:black;text-indent:5px;">

<?php

 

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

{

$name = $_GET['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";

    }

 

    ?>

   

    </div>

   

    <br /><br /><br />

    <div style="width:600px;text-align:center;border-color:black;text-indent:5px;>

  <br /><br /><br /><br /><br />

    <li class="direccion"><a href="<?=$_SERVER['PHP_SELF']?>?continue=1">Si su informacion esta correcta click aqui.</a></li>

    <br />

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

 

<br /><br />

 

</div>

 

<?

}

 

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

If you want to show what the user selected on the next page, make the form "post" by making its method=post. (Which it already has done.) You can also use "get". It will just show everything in the address bar.

 

Then on the next page (confirm.php), you can do something like this: <? echo $_POST['field']; ?>. This will show the "value" of field.

 

"name" is the name of the field you're trying to show.

 

For example, <input type="text" name="field" value="6">. Using $_POST['field']; will show the value (6).

 

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.