...

View Full Version : css divisions and php form submittal



gadolinium
11-08-2012, 10:27 AM
Hello,

I have a series of html elements such as text fields the values of which I'm currently trying to submit to another page via $_POST. However, I want some of these elements to be located on the right side of the page and some of them on the left. I tried using a form to encompass two css divisions, one floated to the left and one to the right. Submitting the entire form doesn't seem to work when it's divided this way, though. Is there any way I can separate my webpage into two columns and still send the data from both columns to the next page when a user clicks the submit button?

Thanks in advance for any help provided.

sunfighter
11-08-2012, 01:27 PM
You need to post your form. Styling has nothing to do with what is passed or not. You do need to have a name attribute for everything that's passed.

gadolinium
11-08-2012, 04:00 PM
My problem is that if I extend my form tag past the end of the left division's end, all the subsequent post method commands don't send their corresponding elements' values. I'm not sure how to fix this while still preserving a two-column layout for this page.

My code:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
.floatright{float: right; }
.title
{
width:769px;
height: 65px;
margin:15px auto;
}
.left_side
{
float: left;
margin: 20px 0 20px 0;
padding: 0 0 25px 15px;
width: 500px;
border: 1px solid #CCCCCC;
background-color: #FFFFFF;
color: #000000;
}
.right_side
{
float:right;
width:500px;
color: #000000;
background-color: #FFFFFF;
margin: 20px 0px 20px 0px;
padding:0px 0px 25px 15px;
border:1px solid #CCCCCC;
}
</style>
</head>
<body>
<div class = "title"><h1>Purchase a ticket</h1></div>
<div class = "left_side">
<p style="color:purple">Booking Details</p><br>

From
<form action = "printticketp.php" method ="post" target="_blank"> <select name="slocation">
<option value="Phoenix1">Phoenix</option>
<option value="Phoenix2">Phoenix</option>
<option value="Phoenix3">Phoenix</option>
<option value="Phoenix4">Phoenix</option>
</select> <br><br>
To

<select name="destination">
<option value="San Diego">San Diego</option>
<option value="Las Vegas">Las Vegas</option>
<option value="Los Angeles">Los Angeles</option>
<option value="San Jose">San Jose</option>
</select> <br><br>
Booking Date
<input type="text" name="date">
<font color = "red">(mm/dd/yyyy)</font><br><br>
Class

<select name = "class">
<option value="Economic">Economic</option>
<option value="Business">Business</option>
</select>
<input type="submit" value="Purchase a flight" >
</div>
<div class = "right_side">
<p style = "color:purple">Passengers</p><br>
Adults(12+) <select name ="nadults"><option value = "1">1</option>
<option value = "2">2</option>
<option value = "3">3</option>
<option value = "4">4</option>
<option value = "5">5</option>
</select><br><br>
Children(2-11)
<select name ="children">
<option value = "0">0</option>
<option value = "1">1</option>
<option value = "2">2</option>
<option value = "3">3</option>
</select><br><br>
Enfants(under 2)
<select name ="nenfants">
<option value = "0">0</option>
<option value = "1">1</option>
<option value = "2">2</option>
</select>
</div>
</form>


</select>
</body>


All the post commands work until the end of the left division.

sunfighter
11-09-2012, 03:16 PM
Start with some errors,
You get it right here:
<p style="color:purple">Booking Details</p><br />
But wrong here:
<font color = "red">(mm/dd/yyyy)</font><br /><br />


</form>
<!--</select>--> REMOVE THIS
</body>
</html> ADD THIS


This should fix your problem, Move the location of the opening form tag to this:


<body>
<div class = "title"><h1>Purchase a ticket</h1></div>
<form action = "printticketp.php" method ="post" target="_blank">REMOVE THE target="_blank"
<div class = "left_side">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum