Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,180
    Thanks
    23
    Thanked 603 Times in 602 Posts
    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.

  • #3
    New Coder
    Join Date
    Jun 2012
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,180
    Thanks
    23
    Thanked 603 Times in 602 Posts
    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">


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •