Results 1 to 2 of 2

Thread: Apache Form

  1. #1
    Join Date
    Oct 2003
    Location
    Florida
    Posts
    1

    Unanswered: Apache Form

    Hi, I'm new to Oracle and am having some troble making an Apache form to update a table.The form should extract data from a customer table, put it into the form fields and then update any changes back to the table. Here is the code I have already. Am I even on track?

    create or replace procedure account_update as

    C_customer_id customer.customer_id%type;
    C_last_name customer.last_name%type;
    C_first_name customer.first_name%type;
    C_address customer.address%type;
    C_city customer.city%type;
    C_state customer.state%type;
    C_zipcode customer.zipcode%type;
    C_email customer.email%type;
    C_password customer.password%type;
    C_username customer.username%type;

    begin

    select C.*
    into C_customer_id,
    C_last_name,
    C_first_name,
    C_address,
    C_city,
    C_state,
    C_zipcode,
    C_email,
    C_password,
    C_username
    from customer C
    where C.username = 'rorymcfarr';

    htp.htmlOpen;
    htp.headOpen;
    htp.title('Account Update');
    htp.headClose;
    htp.bodyOpen;
    htp.formOpen('account_customer', 'post');
    htp.print('Account Number');
    htp.formText (C_customer_id);
    htp.br;
    htp.print('First Name');
    htp.formText(C_first_name);
    htp.br;
    htp.print('Last Name');
    htp.formText(cname => 'C_last_name');
    htp.br;
    htp.print('Address');
    htp.formText(cname => 'C_address', csize => '40');
    htp.br;
    htp.print('City');
    htp.formText(cname => 'C_city');
    htp.br;
    htp.print('State');
    htp.formText(cname => 'C_state');
    htp.br;
    htp.print('Zipcode');
    htp.formText(cname => 'C_zipcode');
    htp.br;
    htp.print('Email');
    htp.formText(cname => 'C_email');
    htp.br;
    htp.print('Password');
    htp.formPassword(cname => 'C_password');
    htp.br;
    htp.print('User Name');
    htp.formText(cname => 'C_username');
    htp.br;
    htp.formSubmit(NULL, 'Submit');
    htp.formReset('Reset', NULL);
    htp.formClose;
    htp.bodyClose;
    htp.htmlClose;
    end account_update;


    create or replace procedure account_customer(customer_id in number,
    first_name in varchar2,
    last_name in varchar2,
    address in varchar2,
    city in varchar2,
    state in varchar2,
    zipcode in number,
    myemail in varchar2,
    password in varchar2,
    username in varchar2) as

    cust_id customer.customer_id%type;

    begin

    insert into customer
    values
    (customer_id,
    last_name,
    first_name,
    address,
    city,
    state,
    zipcode,
    myemail,
    password,
    username);
    commit;

    --if no customer matches, no_data_found is raised
    select customer_id into cust_id from customer where email = myemail;

    --adds session cookie to users header
    owa_util.mime_header('text/html', FALSE);
    owa_cookie.send('session', cust_id, sysdate + 1);
    owa_util.http_header_close;

    htp.htmlOpen;
    htp.headOpen;
    htp.title('Account Update');
    htp.headClose;

    htp.bodyOpen;

    htp.print('Account Updated Complete');
    htp.anchor('videolist', 'View our selection.');

    htp.bodyClose;
    htp.htmlClose;

    exception
    when NO_DATA_FOUND then
    owa_util.redirect_url('login?loginerror=true');
    when others then
    htp.print('Error#' || SQLCODE || ' : ' || SUBSTR(SQLERRM, 1, 100));

    end account_customer;

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1

    Re: Apache Form

    Originally posted by roarman
    Hi, I'm new to Oracle and am having some troble making an Apache form to update a table.The form should extract data from a customer table, put it into the form fields and then update any changes back to the table. Here is the code I have already. Am I even on track?

    create or replace procedure account_update as

    C_customer_id customer.customer_id%type;
    C_last_name customer.last_name%type;
    C_first_name customer.first_name%type;
    C_address customer.address%type;
    C_city customer.city%type;
    C_state customer.state%type;
    C_zipcode customer.zipcode%type;
    C_email customer.email%type;
    C_password customer.password%type;
    C_username customer.username%type;

    begin

    select C.*
    into C_customer_id,
    C_last_name,
    C_first_name,
    C_address,
    C_city,
    C_state,
    C_zipcode,
    C_email,
    C_password,
    C_username
    from customer C
    where C.username = 'rorymcfarr';

    htp.htmlOpen;
    htp.headOpen;
    htp.title('Account Update');
    htp.headClose;
    htp.bodyOpen;
    htp.formOpen('account_customer', 'post');
    htp.print('Account Number');
    htp.formText (C_customer_id);
    htp.br;
    htp.print('First Name');
    htp.formText(C_first_name);
    htp.br;
    htp.print('Last Name');
    htp.formText(cname => 'C_last_name');
    htp.br;
    htp.print('Address');
    htp.formText(cname => 'C_address', csize => '40');
    htp.br;
    htp.print('City');
    htp.formText(cname => 'C_city');
    htp.br;
    htp.print('State');
    htp.formText(cname => 'C_state');
    htp.br;
    htp.print('Zipcode');
    htp.formText(cname => 'C_zipcode');
    htp.br;
    htp.print('Email');
    htp.formText(cname => 'C_email');
    htp.br;
    htp.print('Password');
    htp.formPassword(cname => 'C_password');
    htp.br;
    htp.print('User Name');
    htp.formText(cname => 'C_username');
    htp.br;
    htp.formSubmit(NULL, 'Submit');
    htp.formReset('Reset', NULL);
    htp.formClose;
    htp.bodyClose;
    htp.htmlClose;
    end account_update;


    create or replace procedure account_customer(customer_id in number,
    first_name in varchar2,
    last_name in varchar2,
    address in varchar2,
    city in varchar2,
    state in varchar2,
    zipcode in number,
    myemail in varchar2,
    password in varchar2,
    username in varchar2) as

    cust_id customer.customer_id%type;

    begin

    insert into customer
    values
    (customer_id,
    last_name,
    first_name,
    address,
    city,
    state,
    zipcode,
    myemail,
    password,
    username);
    commit;

    --if no customer matches, no_data_found is raised
    select customer_id into cust_id from customer where email = myemail;

    --adds session cookie to users header
    owa_util.mime_header('text/html', FALSE);
    owa_cookie.send('session', cust_id, sysdate + 1);
    owa_util.http_header_close;

    htp.htmlOpen;
    htp.headOpen;
    htp.title('Account Update');
    htp.headClose;

    htp.bodyOpen;

    htp.print('Account Updated Complete');
    htp.anchor('videolist', 'View our selection.');

    htp.bodyClose;
    htp.htmlClose;

    exception
    when NO_DATA_FOUND then
    owa_util.redirect_url('login?loginerror=true');
    when others then
    htp.print('Error#' || SQLCODE || ' : ' || SUBSTR(SQLERRM, 1, 100));

    end account_customer;
    AFAIK, the short answer is "NO, you re not close".
    AFAIK, Apache can not "talk" directly to any database.
    How does Apache know/decide to which database to connect and as which schema owner?
    One way to get there from here would be to create a CGI interface between Apache & the DB. Another would be to use 9iAS R1 or R2.

Posting Permissions

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