Jump to content

[SOLVED] PHP Form Help


dfowler

Recommended Posts

Hey, I'm trying to setup a form where certain options are hidden and depend on what your choice is to display the next question.  Here is what I have so far.  I could really use some help with this.

 

index.php

<?php
$logo = $_POST['logo'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Project</title>
<style type="text/css">
p.heading {
margin:0px;
font-size:18px;
font-weight:bold;
}
</style>
</head>

<body><?php
include('info.php');
?>
<form action="results.php" method="post">
<table align="center" width="600" style="margin-top:15px;">
<tr>
<td style="border:none; border-bottom:dashed #CCCCCC 1px;">
<p class="heading">Site Type</p>
<?php
foreach($site_type as $value => $name) {
echo '<input type="radio" name="sites" value="'.$value.'">'.$name.'<br />';
}
?>
</td>
</tr>
<tr>
<td style="border:none; border-bottom:dashed #CCCCCC 1px;">
<p class="heading">Number of Pages</p>
<select name="pages">
<?php
foreach($site_pages[0] as $s) {
echo '<option value="'.$s.'">'.$s.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td style="border:none; border-bottom:dashed #CCCCCC 1px;">
<p class="heading">Logo</p>
<select name="logo">
<?php
foreach($logo_choice as $l) {
echo '<option value="'.$l.'">'.$l.'</option>';
}
?>
</select>
<?php
if($logo == 'yes') {
?>
<select name="concepts">
<?php
foreach($logo_con[0] as $c) {
echo '<option value="'.$c.'">'.$c.'</option>';
}
?>
</select>
<?php
}
?>
</td>
</tr>
</table>
</form>
</body>
</html>

 

info.php

<?php
//The type of site the customer wants
$site_type = array("Static", "Content Management", "eCommerce", "MySpace", "Entirely Flash");

//The number of pages the customer wants
$page_row1 = array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20");
//The multiplier for the page they select
$page_row2 = array("4","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5","2.5");
//The rate for the page they select
$page_row3 = array("$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150","$150");
$site_pages = array($page_row1,$page_row2,$page_row3);

//Logo Choices
$logo_choice = array("yes", "no");
//Logo Concepts
$logo_row1 = array("1","2","3");
//Logo Concept Prices
$logo_row2 = array("600","950","1300");
$logo_con = array($logo_row1,$logo_row2);
?>

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.