Add confirmation message

Hi-
I've created a simple form and after the user clicks the submit button, I would like to display a brief confirmation message (e.g., "Record submitted").
I searched the discussion forums but didn't have any luck. I've attached the html and php code below. Thanks!
---HTML CODE--
<body>
<h3>Add a Record</h3>
<form action="add_record.php" method="post" name="Add Record">
    <p>Title:
      <input name="book_title" type="text" value="" size="125" />
    </p>
    <p>Author: <input name="author" type="text" /></p>
    <p>Year: <input name="year" type="text" /></p>
    <p>Publisher: <input name="publisher" type="text" /></p>
    <p>Available as ebook?: <select name="ebook">
        <option value="Yes">Yes</option>
        <option value="No">No</option>
        </select></p>
    <p>Amazon Rank: <input name="amazon_rank" type="text" /></p>
  <p><input name="Submit" type="submit" value="Submit" /></p>
</form>
</body>
--PHP CODE--
<?php
include("includes/connect_info.php");
$connection = mysql_connect($hostname, $mysql_login, $mysql_password);
$dbs = mysql_select_db($database, $connection);
$book_title = mysql_real_escape_string($_POST["book_title"]);
$author = mysql_real_escape_string($_POST["author"]);
$year = mysql_real_escape_string($_POST["year"]);
$publisher = mysql_real_escape_string($_POST["publisher"]);
$ebook = mysql_real_escape_string($_POST["ebook"]);
$amazon_rank = mysql_real_escape_string($_POST["amazon_rank"]);
$insert=mysql_query("INSERT INTO mydatabase.mytable (book_title, author, year, publisher, ebook, amazon_rank) VALUES ('$book_title', '$author', '$year', '$publisher', '$ebook', '$amazon_rank')");
mysql_close();
?>

SuperSonic65 wrote:
Where should I put the header function? I tried putting it right after
<?php
but it didn't work. Do I need to delete the exit; since there are functions that follow the header function? Thanks.
-------PHP CODE BELOW----
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Update Record</title>
</head>
<body>
<?php
include("includes/connect_info.php");
$connection= mysql_connect($hostname, $mysql_login , $mysql_password);
$dbs = mysql_select_db($database, $connection);
//Assign the data passed from website to a variable
$book_id = mysql_real_escape_string($_POST["book_id"]);
$year = mysql_real_escape_string($_POST["year"]);
$insert=mysql_query("UPDATE mydatabase.mytable SET year='$year' WHERE book_id='$book_id';");
mysql_close();
?>
</body>
</html>
If that page is your PHP page, get rid of everything that comes before <?php and after ?>.  PHP pages do not need HTML in them.  In fact, if you run the header code on a page in that fashion you will typically generate the error saying that the header was already sent, because the HTML <head> was already processed so the PHP thinks its a duplicate. 

Similar Messages

  • Why am I getting this error?  How do I add confirm message to button press?

    Using Java Studio Creator.
    I do not understand why I am getting the following page error:
    Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.
    Exception Details: java.lang.IndexOutOfBoundsException
    Index: 0, Size: 0
    Possible Source of Error:
    Class Name: java.util.ArrayList
    File Name: ArrayList.java
    Method Name: RangeCheck
    Line Number: 546
    ======================================================================
    I have a page that works.
    It has a button that is created in the session bean code with the following java:
    button = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
    button.setActionListener( application.createMethodBinding("#{ScheduleEditSessionBean.mainApply}", new Class[]{ActionEvent.class} ));
    button.setId( "applyUndates" );
    button.setType( "submit" );
    button.setTitle( "Apply updates.");
    button.setValue( "Apply" );
    button.setStyle(style);
    children.add(button);
    When the button is pushed, it calls the following session bean method:
    public void mainApply(ActionEvent actionEvent)
    updateScheduleData();
    scheduleAdjustFlag = 1;
    dataApplied = true;
    dataSaved = false;
    addControls();
    This all works just fine - no errors
    ====================================================================
    I wanted to add confirmation to the button press, so I removed the action listener for this button and added
    a javascript function call for the onclick method
    button = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
    style = "text-align: center; font-family: 'Arial','Helvetica',sans-serif; " + font + " height: 22px; width: 115px";
    // Commented out this line button.setActionListener( application.createMethodBinding("#{ScheduleEditSessionBean.mainApply}", new Class[]{ActionEvent.class} ));
    button.setOnclick("confirmApply()"); // Added this line.
    button.setId( "applyUndates" );
    button.setType( "submit" );
    button.setTitle( "Apply updates.");
    button.setValue( "Apply" );
    button.setStyle(style);
    children.add(button);
    I added a dummy button to the page that has the following call to execute the mainApply method in the sessioon bean.
    The button action just calls the mainApply() method in the session bean
    public String mainApplyBtn_action() {
    seb.mainApply();
    return null;
    Added the javascript to the page that simply pushes the dummy button if confirmed.
    function confirmApply()
    if( confirm( 'Are you sure you want to Apply these changes?' ) )
    form1["form1:mainApplyBtn"].click();
    The session bean method looks like this it is the same method as before, but without the action event argument.
    public void mainApply()
    lsb.logMsg( "<ScheduleEditBean.mainApply> Main apply pushed" );
    updateScheduleData();
    scheduleAdjustFlag = 1;
    dataApplied = true;
    dataSaved = false;
    addControls();
    ==================================================================================
    Now, when I push the original 'Apply' button, I get the confirmation box just like I expected.
    But when I confirm the question, I get the error at the top of this post.
    If I push the 'dummy button' directly, I do not get the error.
    I do not understand why I should be gettng this error.
    Can anyone give me a clue as to why this change would cause the problem?
    The error is related to an ArrayList.
    I use several of these on the page, but they should be filled with data in the preRender method of the page.
    Can anyone suggest a way that I can add confirmation to a button that is created under program control?
    Thanks

    Make use of the fact that when an onclick event of a button returns 'false', the action will not be taken.
    Pseudocode:<h:commandButton value="submit" action="#{myBean.action}" onclick="return confirm('Are you sure?');" />

  • How to add confirm message before submit

    How to jump confirm box before form submit?

    chan15tw wrote:
    How to jump confirm box before form submit?
    there are several ways do do that, however the underlying technology is always javascript. Please read the webreference.com tutorial "JavaScript's confirm() Method With Form Submission" here
    Cheers,
    Günter

  • Button not disabling using Java Script after confirm message in button

    I have a STAGEDATA button on a form with the following code to prevent Resubmissions (Apex 4.0)
    Action When Button Clicked:
    Action: Redirect to URL
    Execute Validations: Yes
    URL Target:
    javascript:if ( apex.confirm('Have you saved the data on the current page? Please confirm.','STAGEDATA') ) {javascript:this.disabled=true;this.value='Staging data...';apex.submit('STAGEDATA');}
    When I click the button, the confirmation message is displayed.
    However, after the confirmation message is displayed, the button is not disabled and the value does not show, while post processing of the page takes place before moving to the next page.
    Am I missing something?
    Appreciate your help. Thanks in advance

    Hi,
    try adding
    <script>
       alert('Testing');
    </script>
    This actually adds the script to the page body and not the header as af:resources does
    Frank

  • Issue with page processing - confirmation message & show /hide a button..

    Hello,
    I am working on a to do list application.
    I have events and for each event, I show list of tasks (grouped in reports based on the calculated task's status).
    In one region I have a drop down list of events and a Select Event button.
    For each task, I had to create a CLOSE option (initially I used a link, but the requester wanted a confirmation before closing the task).
    Now I have a checkbox for each task (generated dynamically with apex_item.checkbox(1,task_id)).
    Closing a task in my application means to set the end_date to sysdate.
    I followed the instructions from
    http://download-west.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28839/check_box.htm#CEGEFFBD. I've created also a button and a process and updated the sql from "delete" to "update".
    The process is set: OnSubmit - After Computations and Validations; Run Process Once per page visit (default).
    The issue number 1 is that I see the confirmation message (that tasks have been closed) every time I reload the page (the same when I click Select_event button).. not only after I press on that Close_task button..
    For issue number 2, I have to mention that I've added a condition to show / hide the Close_task button, only if I have at least 1 task in the report.
    The issue number 2 is that I see the button only if I click 2 times on the Select_Event button.. The same is for hide.
    I feel like I am missing something very important about how to synchronize different events(buttons clicks), processes..
    help..?
    Thank you!
    Anca

    This forum is magic..
    As soon as write here, I find the answer!
    Issue 1: I fixed it by specifying this: When Button Pressed (Process After Submit When this Button is Pressed) and my button. I miseed this 1st time.
    Issue 2: I moved the button after the report.. and now it's working just fine!
    I did this about it for some time before asking the question here.. but I just had to write here and got the right answer ;)
    Have a nice day!
    Anca

  • Prob.. confirm message

    hey...
    its the updation query.In this page when i click the update button it updates the values in the row..and this query is working...
    I want to do that..when i click a update button it gives me a confirms message whether did u want to update the row and also displaying the particular gl_code no in that confirms message.when i click on yes it updates the row..otherwise it doesnot.
    after updation it shows message that this particular gl_code no is has been updated.
    <%
    String action = request.getParameter("action");
    if (action != null && action.equals("update")) {
    conn.setAutoCommit(false);
    PreparedStatement pstatement = conn.prepareStatement(
    "UPDATE gl_mast SET gl_descr = ?, db_amt = ?, " +
    "cr_amt = ?, gl_type = ? , gl_pct = ? WHERE gl_code=?");
    pstatement.setString(1, request.getParameter("gl_descr"));
    pstatement.setFloat(2,Float.parseFloat(request.getParameter("db_amt")));
    pstatement.setFloat(3,Float.parseFloat(request.getParameter("cr_amt")));
    pstatement.setString(4, request.getParameter("gl_type"));
    pstatement.setFloat(5,Float.parseFloat(request.getParameter("gl_pct")));
    pstatement.setInt(6,Integer.parseInt(request.getParameter("gl_code")));
    int rowCount = pstatement.executeUpdate();
    conn.setAutoCommit(false);
    conn.setAutoCommit(true);
    %>
    <%
    Statement statement = conn.createStatement();
    ResultSet rs = statement.executeQuery
    ("SELECT * FROM gl_mast ");
    %>
    <form action="gl_update.jsp" method="get">
    <input type="hidden" value="update" name="action">
    <tr>
    <td><input value="<%= rs.getInt("gl_code") %>" size="5" name="gl_code"></td>
    <td><input value="<%= rs.getString("gl_descr") %>" size="55" name="gl_descr"></td>
    <td><input value="<%= rs.getFloat("db_amt") %>" size="12" name="db_amt"></td>
    <td><input value="<%= rs.getFloat("cr_amt") %>" size="12" name="cr_amt"></td>
    <td><input value="<%= rs.getString("gl_type") %>" size="3" name="gl_type"></td>
    <td><input value="<%= rs.getFloat("gl_pct") %>"size="5" name="gl_pct"></td>
    <td><input type="submit" value="Update"></td>
    </tr>
    </form>

    int rowCount = pstatement.executeUpdate();
    conn.setAutoCommit(false);
    conn.setAutoCommit(true);
    Just a doubt... could you tell me why you are doing this?
    ***Annie***

  • How do I add text messages to my icloud account

    How do I add text message to my online icloud backup account?

    Hello mawardjr,
    Thank you for using Apple Support Communities.
    For more information, take a look at:
    iCloud: iCloud storage and backup overview
    http://support.apple.com/kb/PH12519?viewlocale=en_US
    Here’s what iCloud backs up:
    Purchased history for music, movies, TV shows, apps, and booksYour iCloud backup includes information about the content you have purchased, but not the purchased content itself.
    Photos and videos in your Camera Roll
    Device settings
    App data
    Home screen and app organization
    iMessage, text (SMS), and MMS messages
    Ringtones
    Visual Voicemail
    Have a nice day,
    Mario

  • How to add a message to a field in a dataTable row?

    I have a dataTable with a var "selectedUser". Each row has a 2 fields: username & password, both editable and 2 buttons: save and delete. In the "UsersControllerBean.updateUser" method associated with the update button, I want to be able to add an error message to the field on the corresponding row where the button has been clicked. How can I retrieve the client Id of the field from the "selectedUser" var associated with the dataTable (that I get from the RequestMap) to add the message to it?
    Is there an easier way of doing this? (no, thanks no link button!)
    Thanks
    Fred
                   <h:form id="users">
                   <h:dataTable border="1" width="100%" value="#{UsersControllerBean.usersList}" var="selectedUser">
                        <h:column>
                             <f:facet name="header">
                                       <h:outputText value="Id"/>
                             </f:facet>
                             <h:outputText value="#{selectedUser.userId}"/>
                        </h:column>
                        <h:column>
                             <f:facet name="header">
                                       <h:outputText value="Name"/>
                             </f:facet>
                             <h:inputText id="username" required="true" value="#{selectedUser.username}"/>
                             <h:message for="username" style="color: red"/>
                        </h:column>
                        <h:column>
                             <f:facet name="header">
                                       <h:outputText value="Password"/>
                             </f:facet>
                             <h:inputText id="password" value="#{selectedUser.password}"/>
                             <h:message for="password" style="color: red"/>
                        </h:column>
                        <h:column>
                             <f:facet name="header">
                                       <h:outputText value="Actions"/>
                             </f:facet>
                             <h:commandButton value="Save" action="#{UsersControllerBean.updateUser}"/>
                             <f:verbatim>��</f:verbatim>
                             <h:commandButton value="Delete" action="#{UsersControllerBean.deleteUser}" immediate="true"/>
                        </h:column>
                   </h:dataTable>
                   </h:form>

    Dear Friends,
    Finally, I got the answer.
    I required to add the messages to error log for invoice. Error log is displayed in Tree format.
    The error log getting displayed while processing invoice with help of table VBSK.
    We can update the VBSK table information with required message to put in log.
    Best regards,
    Amol Chaudhari.

  • How to add error message to return structure of calling BAPI from a BADI

    i have a bapi where a badi is triggered.this badi method has just importing and changing parameters.is there any way with which i can add error message to the return structure of calling bapi.please reply at the earliest.High points can be expected.

    thanks got it

  • How to add log messages in the sever/webui objects?

    Hi,
    I am new to the OA Framework.
    Can any one share any information in how to add log messages in the sever/webui objects?
    What are the beans I need to use to show in the diagnostic page?
    Can I get sample code for this log staments?
    Thanks in advance,
    Padma

    Hello. This forum is for reporting problems with the published Oracle documentation. You have a better change of getting a reply if you post your question on the Database - General forum.
    Regards,
    Diana

  • How to use *MonitorManager* to add custom messages in channel monitoring?

    Hi experts,
    How to use MonitorManager to add custom messages in channel monitoring for custom adapter development(Not in audit log).
    like
    Type   Time Stamp   Message ID   Explanation 
      6/25/11 6:39:47 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message processing completed successfully
      6/25/11 6:39:47 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message with ID 00199942-6e43-02df-96ca-8b538c63dd98 processed
      6/25/11 6:39:46 AM 00199942-6e43-02df-96ca-8b538c63dd98 Message processing started
      6/24/11 6:43:26 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message processing completed successfully
      6/24/11 6:43:26 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message with ID 00199942-6e43-02ef-96b1-7650f3495e03 processed
      6/24/11 6:43:24 AM 00199942-6e43-02ef-96b1-7650f3495e03 Message processing started
      6/23/11 6:45:52 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message processing completed successfully
      6/23/11 6:45:52 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message with ID 00199942-6e43-02df-9698-5be345a9ddf5 processed
      6/23/11 6:45:50 AM 00199942-6e43-02df-9698-5be345a9ddf5 Message processing started
      6/22/11 6:43:30 AM 00199942-6e43-02ef-95ff-2c03493dc078 Message processing completed successfully
    Edited by: SAP_PI_D on Jun 28, 2011 12:10 PM

    Solve by myself

  • Jdbc adapter error on confirmation message in message monitor (rwb)

    I have the scenario iDoc -> PI 7 - > jdbc (AS400 odbc driver).
    When I do INSERT statements, the data is stored in the Database and the RWB message monitoring shows status Successfull.
    However, for every insert, an other message shows up in the message monitoring with reversed Sender and Receiver (so it looks like a confirmation message is trying to find its way back to XI). This message first is is Status "Waiting", and after some time gets in Status "System Error".
    As I am not expecting any responses in my XI configuration (as I have no place to send them to), I want to stop these messages showing up in the Adapter Engine (as there will be many Error Status messages that are of no interest to me).
    How can I stop these messages, or what should I do in XI to process them (and dump them in my receiver determination). I have NO  BPM involved .

    Hi,
    For each open connection a entry is made j2ee stack.So when the it reaches to max and execption is thrown.
    In Jdbc adapter configuration -> advance mode -> Set -> Disconnect from the database after processing each message.
    Should solve the prob
    <b>Cheers,
    *RAJ*
    *REWARD POINTS IF FOUND USEFULL*</b>

  • In po,every time i want to add the message for print out.

    in po,every time i want to add the message for print out.
    is there any permanent solution for above issues ?

    Hi,
    1) use transaction nace
    2)Select application EF  and go to condition records
    3) o/p type is neu , select the same and double click on it .
    4) select paricular condition table.
    5) maintain condition records , means for particular combination NEU should appear automatically in PO print.

  • How to add warning message while using 'print' function in Adobe LiveCycle Designer

    I am trying to make pdf document for my company which requires adding a warning message while anyone use 'print' function from the page...
    Does anyone know how to add warning message on LiveCycle Designer
    Also my supervisor mentioned something using 'nag' if that rings any bell

    No you shoudl never go into the XML source unless uinstricted to do so.
    You can open the script editor (under the window menu). It will appear above the drawing area but below the toolbars. You can resize it if there is not enough room. When you click on an object in the form you can choose an event to script against in the Show dropdown. In your case you will want to choose the prePrint event. A line will show up that indicates the object that is associated with the script as well as the event and other information. Add your script below this line. Once that is done you are finished and your form is ready for testing.
    Paul

  • Exporting to PDF - Selection Formula confirmation message

    Hi,
    We're using Crystal Reports 11 from within a Delphi 7 application which, on a timed schedule, loads data into a MS SQL server database and generates and prints or e-mails a report of the data loaded in PDF format. This process should be automatic and not require monitoring but we're now seeing the report generation being stalled by a confirmation message appearing when the report is generated. The message reads:
    Confirm
    Selection Formula for {Report Name} to Printer   // or To Export
    {Selection Formula Here}
    Continue?
    (RETRY=edit with Crystal, All=copy to clipboard)
    Buttons: Yes No Retry All
    Any help appreciated.
    Thanks,
    Garry

    I'm wondering if this could be easily fixed by going to the links panel and then use the "Copy Links To" and set up a new links folder for the job.
    That would copy all the links and then relink to that folder - right?
    Perhaps that's a quick way to get rid of this problem.
    It could be anything though - I've had weird, but not this problem, of files that are on a server can cause link problems.
    I don't know - it's a one of those have to sit down and look at the files to see what's going on situation - like Bob already said.

Maybe you are looking for

  • Java stack not starting in a PI 7.1 instance

    Hi experts, We are facing a probling while starting a PI 7.1 instance. the Java stack is not getting up. It is coming up to the phase 'starting apps' and failing from there. We had recently updated the support pack of the instance from 6 to 7. But th

  • HP Laserjet P4015n thinks its a P4515n

    Hi there, I Have an HP P4015 which paper jams only when doing large print jobs (100 pages plus) It has been doing this ever since it had a firmware upgrage done on it which for some reason made it think it is a P4515 instead of the slower P4015. This

  • Transfer 100M XML file with XSL

    Hi, I am trying to transfer 100M XML file with XSL. Input.xml is the XML file, format.xsl is the XSL file. I type in the command line as: java org.apache.xalan.xslt.Process -IN input.xml -XSL format.xsl -OUT output.xml It got "out of memeory" error.

  • I reedemed a movie and it only downloaded in hd and I need it in SD is there a way to get the sd version?

    I recently bought the hunger games catching fire movie combo, which included the the sd and hd movie plus the digital reemption code for itunes.  When I reeded the code onlt the HD version of the movie showed up in my purchased area.  I have a ipod c

  • Running color on 20" imac

    Will Color run on a 20" 2.4GHz iMac Aluminum? And if so, how is the performance? Thanks