Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-08-2012, 10:27 AM   PM User | #1
gadolinium
New Coder

 
Join Date: Jun 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
gadolinium is an unknown quantity at this point
css divisions and php form submittal

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.
gadolinium is offline   Reply With Quote
Old 11-08-2012, 01:27 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,498
Thanks: 18
Thanked 361 Times in 360 Posts
sunfighter is on a distinguished road
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.
sunfighter is offline   Reply With Quote
Old 11-08-2012, 04:00 PM   PM User | #3
gadolinium
New Coder

 
Join Date: Jun 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
gadolinium is an unknown quantity at this point
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:
PHP 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{floatright; }
.
title
      
{
      
width:769px
      
height65px;
     
margin:15px auto;
      }
.
left_side 
      
{
     
floatleft;
     
margin20px 0 20px 0;
     
padding0 0 25px 15px;
     
width500px;
     
border1px solid #CCCCCC;
     
background-color#FFFFFF;
     
color#000000; 
      
}
.
right_side 
     
{
     
float:right;
     
width:500px;
     
color#000000;
     
background-color#FFFFFF;
     
margin20px 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.
gadolinium is offline   Reply With Quote
Old 11-09-2012, 03:16 PM   PM User | #4
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,498
Thanks: 18
Thanked 361 Times in 360 Posts
sunfighter is on a distinguished road
Start with some errors,
You get it right here:
Code:
<p style="color:purple">Booking Details</p><br />
But wrong here:
Code:
<font color = "red">(mm/dd/yyyy)</font><br /><br />
Code:
</form>
<!--</select>--> REMOVE THIS 
</body>
</html>   ADD THIS
This should fix your problem, Move the location of the opening form tag to this:
Code:
<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">
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:46 AM.


Advertisement
Log in to turn off these ads.