Problem populating html form fields with data from database.

I'm using a straight forward piece of code to populate a form with data from a database, to create and 'edit record' page. The code is as follows;
TO RETREVE THE DATA FROM THE DATABASE;
     $query = "SELECT * FROM $table WHERE newsletter_id = '$newsletter_id'" ;
     mysql_select_db($database) ;
     $result = mysql_query($query, $connect);
     $numRows = mysql_num_rows($result);
     $dbnewsletter_title = mysql_result($result,$i,'newsletter_title');
TO POPULATE THE FORM FEILD;
<tr>
          <td width="140"><p class="admin">Newsletter title</p></td>
          <td><input name="newsletter_title" type="text" <? print "value=$dbnewsletter_title";}?> /></td>
        </tr>
However, when I view the page, the string shows in the text feild, but seems to be split at the point of the first space. So basically only the first word of the string shows in the text field. If I try to print '$dbnewsletter_title' outside of the table, the string is shown in full as it should be.
Does anyone know what is causing this problem?
Many Thanks

Put the value in quotes:
<?php print "value='$dbnewsletter_title'"; ?>

Similar Messages

  • Having issues with populating a Text Field with data from 2 other fields

    I have 3 fields Tools_1a_pri, Tools_1a_pri_other, Tools_1a_pri_txt.
    Tools_1a_pri is a drop down combo with a predefined list. One of the options is "Other".  When "Other" is selected, the text field Tools_1a_pri_other becomes visible for users to enter the name of the other tool.
    The Tools_1a_pri_txt is a text field with a calculation that shows either text stating that no tool has been selected or the Tools_1a_pri & or Tools_1a_pri_other.
    When I select one of the predefined tools, everything works.  When I select other, it appears that nothing has changed.  It requires that I click on another field before it populates.  This is confusing to the user.
    Tools_1a_pri   Validate code
    this.getField("Tools_1a_pri_Other").display = event.value=="Other" ? display.visible : display.hidden;
    Tools_1a_pri_txt  Calculation code
    //if nothing is selected, do the following
    if (getField("Tools_1a_pri").value.length < 2) {
    event.target.textColor = color.red
    event.value = "No primary tool identified";
    }else if (getField("Tools_1a_pri").value != "Other") {
    //otherwise do this if other is selected
    event.target.textColor = color.black
    event.value = getField("Tools_1a_pri").value;
    }else if (getField("Tools_1a_pri").value = "Other") {
    //otherwise do this if other is not selected
    event.target.textColor = color.black
    event.value = getField("Tools_1a_pri").value + " - " + getField("Tools_1a_pri_Other").value;

    You made the classic mistake of using the assignment operator in an if-statement instead of the comparison operator. Change this line:
    } else if (getField("Tools_1a_pri").value = "Other") {
    To this:
    } else if (getField("Tools_1a_pri").value == "Other") {

  • Is it possible to set validation on a form field with data from another field in Adobe Acrobat?

    Thanks in advance for any help and advice. I am trying to set a validation for one field that would make sure that the amount entered is 25% of a different field. I tried setting up a validation, but have been unsuccessful. Can anyone offer any insight or solution? Thanks!

    You'll need to use a script to do it. Something like this should do:
    if (event.value) {
         event.rc = true;
         var v1 = +this.getField("NameOfOtherField").value;
         if (+event.value!=(v1*0.25)) {
              app.alert("The value you entered must be 25% of the value of NameOfOtherField.");
              event.rc = false;
    (This will check if the entered value is exactly 25% of the other value... If you meant something else, please clarify)

  • How to populate Adobe LiveCycle Designer generated  PDF Forms with data from Database in Windows app

    Hi
    I have a PDF template designed in Adobe LiveCycle Designer. This template has form fields which needs to be filled with data programmatically. I am using windows application in C#.Net 2005 in which I want to retrieve data from database and merge this data into PDF form in respective fields.
    How this can be achieved?
    I searched a lot & I found that we can process the XDP file generated from PDF to acheive this. I created the XDP file out of the PDF template created in designer. But I don't know how to merge data from database into that XDP file in respective fields and again convert this XDP file back to PDF programmatically. Can anybody help me ? This is urgent.
    Thanks in advance.
    Sambhaji

    Please ignore the above code.<br />The following one is correct one.<br />using System;<br />using System.Data;<br />using System.Configuration;<br />using System.Web;<br />using System.Web.Security;<br />using System.Web.UI;<br />using System.Web.UI.WebControls;<br />using System.Web.UI.WebControls.WebParts;<br />using System.Web.UI.HtmlControls;<br />using System.Text;<br />public partial class _Default : System.Web.UI.Page <br />{<br />    protected void Page_Load(object sender, EventArgs e)<br />    {<br />        Response.ContentType = "application/vnd.adobe.xdp+xml";<br />        StringBuilder responseString = new StringBuilder();<br />        responseString.Append("<?xml version='1.0' encoding='UTF-8'?>");<br />        responseString.Append("<?xfa generator='AdobeLiveCycleDesigner_V8.0' APIVersion='2.5.6290.0'?>");<br />        responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>");<br />        responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>");<br />        responseString.Append("<xfa:data>");<br /><br />        responseString.Append("<form1>");<br />        responseString.Append("<TextField1>Homer</TextField1>");<br />        responseString.Append("<TextField2>Simpson</TextField2>");<br />        responseString.Append("<field name ='DropDownList1'>");<br />        responseString.Append("<items save='1'>");<br />        responseString.Append("<text>1</text>");<br />        responseString.Append("<text>2</text>");<br />        responseString.Append("<text>3</text>");<br />        responseString.Append("</items>");<br />        responseString.Append("</field>");<br /><br />        responseString.Append("</form1>");<br /><br />        responseString.Append("</xfa:data>");<br />        responseString.Append("</xfa:datasets>");<br />        responseString.Append("<pdf  href='C:\\Test.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />");<br />        responseString.Append("</xdp:xdp>");<br /><br />        Response.Write(responseString);<br />        Response.Flush();<br />        Response.End();<br />    }<br />}

  • Drop Down list in table with data from database table

    Hi,
    I have created an interactive form in WD ABAP.
    In Context tab I have created the nodes as follows:
    ZSOHEADER node with cardinality 1..1
    |-> MATERIAL node with cardinality 0..n. Under MATERIAL node there are 2 attrib. MAKTX and MATNR.
    I am fetching data from MARA table into an internal table IT_MARA.
    The node MATERIAL is bound to internal table IT_MARA.
    I have created a table with property ' Body rows vary depending on data ' .
    I have only one row in table. The first cell of the row is a drop down field.
    I have bind the field to the node MATERIAL->DATA->MAKTX.
    Now the issue is even though I have created only one row in my table, in preview it is creating as many rows in the table as the no.of records in the internal table.
    I want only one row with the drop down list containing all values of the internal table.
    Kindly suggest what to do.
    Regards,
    Vinod

    Hi,
    In the WebDynpro Context, in the main node create another node like A1 with cardinality 0..n and in this node create attributes TEXT and VALUE.
    Now goto method and in that method using code wizard read the node A1.
    And use the below code snippet sample in your program, i.e. code this under respective method of the webdynpro.
    *Declare the TYPES
    TYPES : BEGIN OF TY_TABLE,
    TEXT TYPE SOMETYPE,
    VALUE TYPE SOMETYPE,
    END OF TY_UOM.
    *Define Internal Table and work area.
    DATA : IT_TABLE TYPE STANDARD TABLE OF TY_TABLE INITIAL SIZE 0,
    WA_TABLE TYPE TY_TABLE.
    SELECT TEXT VALUE FROM TABLENAME INTO TABLE IT_TABLE.
    lr_node_info->bind_table( IT_TABLE ).
    And in the Adobe Form Layout
    Go to Menu of the Adobe LiveCycle Designer:
    Tools>Options..>DataBinding
    In that window you just check the Show Dynamic properties Check Box.
    Now for the Drop Down go the binding tab in object palette and click on the list items and there specify the Internal Table and specify the text as the internal table text field and value as internal table value field.
    OR
    From the WebDynpro Native Library Palette use the Value Help Drop Down and in object pallette goto binding tab and provide the form interface binding. Before this in the WebDynpro goto Context and for the particular field under the properties provide the search help as dictionary search help and specify the name of the dictionary search help.
    OR
    We have another method of setting the Text and Value to the DDL directly in the WebDynpro by coding in the methods, I dont have much knowledge on this.
    Regards
    Pradeep Goli

  • Constructing Jtree with data from Database

    Hi
    I am new to JTree and I need some help. My problem goes like this. I have a table in the data base which has data like Folder_Nr, Folder_Name, Folder_Prev_Nr, Folder_Typ_Nr, Folder_Access.
    If the Folder_Nr is 1 and folder_prev_nr =0, then it is a root folder and if folder no is 3 and folder_prev_no is 1 then it is a sub folder of the Folder_Nr 1. and so on is the data. I need to present all these folders in a JTree and be able to dynamically add and delete folders.
    It will be of great help if anyone can provide me with some lead or some source code.
    Thanking u in advance
    BalaaP

    Yes,using LiveCycle you could accomplish this easily.Once you have your invoice form ready based on predefined XSD, you can easily update the form data by fetching the values from database using JDBC operation.Also you could email this updated form using Email service.
    Thanks,
    Wasil

  • Load interactive pdf with data from database

    I am trying to understand our options for loading database data into an interactive pdf..?   Some of the data is not stored in the database and needs to be manually entered by the user in the interactive pdf.
    Here is the interactive pdf I'm working with:
    http://www.dcma.mil/dcman/NPP/files/dd1149.pdf
    As I understand it, there are 2 options:
    1.  Create an xml file from the database data.   Users can manually import this xml file into this existing interactive pdf and then manually add the additional data, and save the interactive pdf.
    Would users need to use Adobe acrobat Standard or Pro edition to import the xml data?
    2.  Create a XFA PDF form that's made with LiveCycle Designer.   Can this method create an interactive pdf so that users can enter additional data later and save the pdf?  
       What adobe products are required to use this method?
    thanks for any assistance..
    -D

    Yes,using LiveCycle you could accomplish this easily.Once you have your invoice form ready based on predefined XSD, you can easily update the form data by fetching the values from database using JDBC operation.Also you could email this updated form using Email service.
    Thanks,
    Wasil

  • Filling checkboxes with data from database

    Hello.
    I need help setting a checkbox value to checked if the corresponding field has "Yes" saved in the database.
    I can do this with textboxes, but haven't figured out how to do it with checkboxes or drop down lists.
    If you can help, please do.
    Thanks.

    In all honesty, problems like this is why programmers tend to make more money than web developers. :) You more or less need to figure out what you want to happen, and then write the code to make that happen. Let me give you an example...
    Let's say we're building a web site that requires people to register and then log in. When they register, they get a checkbox where they can opt in for spam. We've decided to store the user's preference in a database, essentially a field called spam which contains either a "yes" or a "no" value. When the time comes to send out those emails, we simply select all records in the database where that spam field is set to "yes".
    So far, so good.
    If the user decides to check that opt-in checkbox, then we want to set the spam field to "yes". If he already exists in the database, we can use an SQL update statement to set the field. If he doesn't exist, we'll have to create a record for him and set all relevant fields with an insert statement. If he unchecks the box (or leaves it unchecked), then we want to do the same thing but make sure the spam field is set to "no".
    When the user clicks on the submit button, the checkbox is submitted (or not) to the server as one of the parameters. We simply parse the parameters, see if the checkbox was checked or not, then write a little bit of JSP (or Java) code that sends the appropriate SQL statement as above, to the database.
    That's the basic concept.
    There are many slight variations. For example, several web sites will fill in that opt-in checkbox by default every time you visit their site, and you have to uncheck it if you don't want spam. The logic remains the same - just write a little bit of code that sees if the form passed you the checkbox filled in, and then either fill in, or erase the corresponding field in the database.
    (I'm not bothering to add code here because there are many ways to do this, and which way is best really depends on what code college_amy has written so far.)

  • Programmatically generate password for pdf with data from database

    Good day everyone,
      I would like to know is it possible to programmatically generate passwords for pdf??
    The main idea is to enable an automated process of pdf acquiring individualised password from a database (Excel, Access, you name it) and finally sending the pdf to individual recipient. Can I use javascript for this? And if yes, how?? If not, pls do advice me on the appropriate steps.
    Background (for clarity's sake): 
      Currently I am working on developing an automated process for the sending customised, password encrypted payslip to about 80 staff. The entire procedure is pretty much summarized as below:
    mail merg (UBS output in) excel to words -> convert words to pdf -> programmatically password encrypt the pdf -> email to individual recipients.
    Well my current status is - I am quite done with the batch mail merge and convertion part. And batch proccessing of password encryption is not a problem, but the idea is to allow acrobat to retrieve password automatically from a database and not key-in each and every password manually. The batch email for now is another problem but for now I have to work stepwise. (Any ideas on how to do it would equally be valued though! =D)
    System and software using:
    Windows  XP and 7 Professional
    Microsoft Office Proffesional 2010
    Adobe Acrobat X Pro
    I would be really grateful for any relevant replies to my question and any additional thoughts or ideas are welcome!!
    I would to thank any potential saviour in advance!
    Thank you for helping!

    Basically I need to automate the password generation from database extract
    e.g. Excel database with StaffID, StaffName, PayMonth, etc. Then when the pdf is created, its password would be <StaffID>_<PayMonth> which is extracted from excel.
    Is it possible for this to happen?? I dont mine using Javascript, I'll just have to learn it.
    Or how about recommending a program which does that??
    Whichever is fine as long there's a solution!
    Thanks!

  • How to update image with data from database?

    hi,
    is it possible to update an image object which serves as template with some data from a database table like user name etc. by converting it to image bytes and how? The final image would show user name as part of the image

    anybody?

  • Blank form fields with data?

    I've created a form in Acrobat and sent it to a few people to test. When they send it back to me, some people say even though they saved their data, when it's previewed in their browser (email) it looks blank. When I receive forms sent back to me, the form appears blank, but when I click in the field, the answer appears.
    How can I fix the form so that no one is confused by a blank form after they fill it out? I'm not concerned about receiving the blank forms since there is data, I'm more concerned that a customer will see a blank form after they've filled it out and get frustrated.
    BTW, we've tried opening the forms returned to us in MAC and PC, same problem.
    Thanks,
    D

    The problem occurs when the Preview application on a Mac is used to fill-in the forms. It is well known the Preview corrupts PDFs in a number of ways and it should be absolutely avoided when using PDF forms. The damage it does to a document cannot be repaired, but you can open the corrupted form in Acrobat, export the form data (to an FDF or XFDF file), and import it back into a blank form. Then inform your users to use Adobe Reader and not Preview.
    Also, some PDF viewers (e.g., iOS's built-in viewer) have no support for PDF forms at all, so forms will appear blank when opened. The fix for this is to have them open the form in Adobe Reader. This is assuming the form was not corrupted with Preview.

  • Combo filled with data from database

    i want to display the list of schemas dynamically in a combo box and then display the tables in that schema. i tried a servlet; but the schemas are not displayed.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    public class try extends HttpServlet
         public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
         PrintWriter out;
         res.setContentType("text/html");
         out = res.getWriter ();
         try
         out.println("<html>");
         out.println("<head>");
         out.println("<script language='javascript'>");
         out.println("function one()");
         out.println("{");
         out.println(" ResultSet rs=st.executeQuery('select distinct owner from all_tab_columns')");
         out.println("while(rs.next())");
         out.println("{");
         out.println("var newElement=document.createElement('option')");
         out.println("newElement.value=rs.getString(1)");
         out.println("document.form1.table1.options.add(newElement))");
         out.println("}");
         out.println("}");
         out.println("</script>");
         out.println("</head>");
         out.println("<body>");
         out.println("<form name=form1 action=http://mysystem:9000/servlet/query method=post>");
         out.println("Schema name");
         out.println("<input type=textbox name='user'><br>");
         out.println("Password");
         out.println("<input type=password name='pwd'><br>");
         System.out.println("Password");
         out.println("Table Name");
         DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
         Connection m_connection;
    m_connection = DriverManager.getConnection("jdbc:oracle:thin:@mysystem:1521:oracle8","scott","tiger");
         Statement st=m_connection.createStatement();
         System.out.println(st);
         out.println("<select name='table1' onFocus=one();>");
         out.println("<option value=' '>");
         out.println("</option>");
         out.println("</select>");
         out.println("<br>");
         out.println("<input type=submit>");
         out.println("</form>");
         out.println("</body>");
         out.println("</html>");
         }catch(SQLException s){
              out.println("Trial");
         catch(java.lang.Exception x){ }
    }

    If you're wanting to get data back from the database you're actually going to have to execute a query. The Statement:out.println(" ResultSet rs=st.executeQuery('select distinct owner from all_tab_columns')"); will print out the query you wish to run, showing it to the user, but it won't execute it.
    Try instead:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection m_connection;
    m_connection = DriverManager.getConnection("jdbc:oracle:thin:@mysystem:1521:oracle8","scott","tiger");
    Statement st=m_connection.createStatement();
    out.println("<select name='table1' onFocus='one();'>");
    ResultSet rs=st.executeQuery("select distinct owner from all_tab_columns");
    while(rs.next()){
    String val = rs.getString(1);
    out.println("<OPTION VALUE='" + val + "'>" + val + "</OPTION>";
    rs.close();
    st.close();
    out.println("</select>");

  • Generate report with data from database package

    Hi
    Is it possible to generate a report where the values come from an oracle database package instead of from an sql query declared in the report itself?
    If yes, how is it done?
    Appreciate any help. Thx.

    Hi,
    You can use REF CURSORs to generate reports from a database package.
    For information about REF CURSORs, please see Chapter 40 'Building a Paper Report with REF CURSORs' of the Oracle Reports Building Reports manual.
    This chapter is at:
    http://download-uk.oracle.com/docs/html/B13895_01/orbr_refcur.htm#i1011693
    Hope this helps.
    Regards,
    Panna

  • Need help with data from databases

    Hi,
    I need to search several columns in a table, for ex. the Id column and the Headline column. Of cource the id must be connected to the right headline when I want to do something to the data.
    Now I get a Resultset and I have tried out different ways to get the data out from the Resultset but the result doesn't seems to be right. Can anyone help me, please.
    -Thanks-

    You can iterate on your ResultSet if it contains several
    rows.
    Let's imagine you have defined a class Element containing
    the values you want to use.
    List l = new ArrayList();
    // Calling rs.next() put the cursor on the next row
    // and return false if there is no more row
    while (rs.next()) {
    Element e = new Element(rs.getString(1), rs.getInt(2));
    l.add(e);

  • Prepopulating PDF forms with data from XML file

    How can I get a PDF form to open pre-populated with data from an XML file automatically? I've been using Adobe LifeCycle Designer 8.0 and there doesn't seem to be a way to do it. The closest I came was to use the ImportData method, but that only lets you specify a data file if the form is signed (certified), which these aren't and don't need to be because we're using them on an internal company web page. ImportData works if there is no file name, but then the user has to navigate to and select the correct file, which we can't rely on our users to do.
    I've researched this problem for days on this and other websites and haven't found an answer (one Adobe advisor suggested purchasing LifeCycle Forms, which is not an option because it's a $10,000 software package and the company wouldn't authorize a purchase that steep). We will buy a less-expensive option if there is one. We'll even hire a consultant if we can find one to who can design a supportable solution. All suggestions will be much appreciated.

    Hi Sharon
    The easiest way is:
    - Open your PDF form within Acrobat
    - From the File menu, import the XML form data into the form
    - From the File menu, use Save As... to save the file with a new name.
    The new PDF will be identical to the original one, but will have the data embedded in it. Voila.
    If you want the same form to pre-populate with different XML files depending on the circumstances, or if you're generating the XML on the fly, then things get more complicated. (And more expensive.) As your consultant said, LiveCycle Forms is one option, but it is expensive (actually even more than 10K). There are other options, including Cold Fusion, custom servlets, etc.
    Howard
    http://www.avoka.com

Maybe you are looking for

  • To obtain the value of a session variable in a JAVA class

    Hello again. I have a JSP page, in witch I kept a session variable with a value, and later (in the same JSP page) I use a JAVA class to obtain the value stored in this session variable (I make this to verify that this works well and that this is poss

  • Get real path in non servlet class

    Hi, I've created a ServletContextListener class that loads a thread at application startup and kills it and application shutdown. The thread periodically monitors a specific file. I need to pass a real file path to the thread, but because the thread

  • Ask the Expert: C-Series Integration with Cisco Unified Computing System Manager

    Welcome to the Cisco Support Community Ask the Expert conversation. This conversation is an opportunity to learn and ask questions about Cisco C-Series Integration with Cisco Unified Computing System® Manager (Cisco UCS® Manager) with Cisco experts V

  • New iPad new HP 3050a -  how to print?

    How do you get the hp3050a to print off iPad Wireless router service in a house Driving me crazy

  • How To Take Extract Image from a Background?

    I have a pic of a women wearing headphones, the background is white but i want to show her on a black background So i have created a blackground in fireworks.. how do i now get the women out of the background she is in and onto my black ground withou