Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to get this code to print the data from the listbox onto the page?

  1. #1
    Junior Member
    Join Date
    Feb 2019
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default How to get this code to print the data from the listbox onto the page?

    I have it in the code, it just won't print; need to print out the details of a customer selected by a listbox



    <link rel="stylesheet" type="text/css" href="OpenDepositAcc.css">
    <title>Open Deposit Account</title>
    </head>
    <body>
    <!--<form method="post" action="OpenDepositAcc.php"> -->
    <div class="logo">
    <IMG SRC="Logo.png" WIDTH="200" HEIGHT="200"></A>
    </div>

    <div class="form">
    <h2 class="form-heading">Open Deposit Account </h2>
    <h2 class="form-heading">Search a Customer account </h2>
    <br/>


    <?php include "listbox.php"; ?>
    <script>
    function populate()
    {
    var sel = document.getElementById("listbox");
    var result;
    result = sel.options[sel.selectedIndex].value;
    var CustomerDetails = result.split(',');

    document.getElementById("display").innerHTML = "The details of the
    selected person are: " + "<br>Customer ID :" + CustomerDetails[0] + "
    <br>First Name :" + CustomerDetails[1] + "<br>Last Name :" +
    CustomerDetails[2] + "<br>Date of Birth :" + CustomerDetails[3] + "
    <br>Street :" + CustomerDetails[4] + "<br>Town :" + CustomerDetails[5]
    +"<br>County :" + CustomerDetails[6] ;
    }

    <div class="myButton">
    <input type="submit" value="Submit" name="submit" onclick="populate()"/>

    </script>
    <p id ="display"> </p>





    </div>
    </div>
    </form>
    </body>
    </html>

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: How to get this code to print the data from the listbox onto the page?

    Javascript is not the same as java.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    jason_97 (February 16th, 2019)

Similar Threads

  1. Replies: 1
    Last Post: December 3rd, 2012, 02:35 PM
  2. xfa.host.print: print a page + some page range.
    By gammaman in forum Totally Off Topic
    Replies: 2
    Last Post: May 10th, 2012, 08:07 AM
  3. Replies: 1
    Last Post: April 9th, 2012, 05:13 PM
  4. How to print out data from web page to printer????
    By verma86 in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: April 2nd, 2010, 10:26 PM