0
我想提交數據從一個使用PL/SQL在蟾蜍與Web工具包。我有以下如何在Toad中使用PL/SQL提交HTML表單?
procedure add_car is
begin
htp.title('August Vehicle Directory');
htp.bodyopen;
Htp.tableopen('border=1 align=center');
--Header:
HTP.tablerowopen;
htp.tabledata(style('Add New Vehicle','#t_1'),'center', ccolspan => '5');
HTP.tablerowclose;
htp.tablerowopen;
htp.tabledata(style('Please add a vehicle to the database by filling out the forum below.','#t_msg'),'center',ccolspan=>'11');
htp.tablerowclose;
-- Text-box entry:
htp.tablerowopen;
HTP.P('<td>');
htp.tableopen();
--
htp.formopen('john_package.submit_newcar','post');
htp.tablerowopen;
htp.tabledata(style('Make: ','#t_b'),'center');
htp.tabledata('<input type="text" name="make_box" size="20" maxlength="30" value="">');
htp.tabledata(' ');
htp.tabledata(style('Model: ','#t_b'),'center');
htp.tabledata('<input type="text" name="model_box" size="20" maxlength="30" value="">');
htp.tabledata(' ');
htp.tabledata(style('Year: ','#t_b'),'center');
htp.tabledata('<input type="text" name="year_box" size="20" maxlength="30" value="">');
htp.tabledata(' ');
htp.tabledata(style('Engine: ','#t_b'),'center');
htp.tabledata('<input type="text" name="engine_box" size="20" maxlength="30" value="">');
htp.tabledata(' ');
htp.tabledata(style('Seats: ','#t_b'),'center');
HTP.P('<td>');
htp.formSelectOpen('seats_dropdown');
htp.formSelectOption('1');
htp.formSelectOption('2');
htp.formSelectOption('3');
htp.formSelectOption('4');
htp.formSelectOption('5');
htp.formSelectOption('6');
htp.formSelectOption('7');
htp.formSelectOption('8');
htp.formSelectOption('9');
htp.formSelectOption('10');
htp.formSelectClose;
HTP.P('</TD>');
htp.tablerowclose;
htp.formclose;
--
htp.tableclose;
HTP.P('</TD>');
htp.tablerowclose;
HTP.tablerowopen;
HTP.P('<td align =center colspan=2>');
htp.tableopen();
htp.tabledata(support.button(0,'p_Submit','Add Vehicle','onClick="return this.form"'));
htp.tabledata(support.button(0,'john_package.loadpage','Cancel', 1, null, null),'center');
htp.tableclose;
HTP.P('</TD>');
HTP.tablerowclose;
htp.tableclose;
htp.bodyclose;
exception
when others then
htp.p('Error: '||TO_CHAR(SQLCODE)||'-'||SQLERRM);
write_log ('john_package.add_car', to_char(SQLCODE)||'-'||SQLERRM);
end add_car;
然後我有shuold從上面所提交的表單中插入數據的過程:
procedure submit_newcar(
p_make varchar2 default null,
p_model varchar2 default null,
p_year varchar2 default null, --Year produced
p_engine varchar2 default null, --Engine type
p_seats varchar2 default null --Number of seats
) IS
begin
INSERT INTO JOHN_TABLE_CAR
(ID, MAKE, MODEL, YEAR, ENGINE, SEATS)
VALUES
(null, p_make, p_model, p_year, p_engine, p_seats);
exception
when others then
htp.p('Error: '||TO_CHAR(SQLCODE)||'-'||SQLERRM);
write_log ('john_package.submit_newcar', to_char(SQLCODE)||'-'||SQLERRM);
end submit_newcar;
這似乎並不奏效,我希望的方式。每次點擊我的「添加車輛」按鈕,似乎我的「submit_newcar」過程插入沒有被調用。我怎樣才能使這個工作正常?