Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make Button Click Execute Code

Status
Not open for further replies.

Anddmx

Technical User
Apr 26, 2004
56
US
Hi,

Iam haven some problem with my code.

All I want to do is open up connect to database and insert data after button on the page has been clicked. Right now it doesnt execute unless I remove |"If Len(Request.Form("form1")) > 0 Then" and "End If" then when page is loaded it insert data which is good but not really because I then I get bad data because no one had selected anything in the form and to solve my delima I just want the code to be executed after button has been click.

Everything I do just wont work... there is input button that has name="image3222" and when the button is click if statement should fire but it doesnt.

I cant see whats wrong so maybe someone on this forums can get me in the right direction.

Thanks

<input type="image" src="../Images/submit_radio.gif" width="70" height="25" border="0" name="image3222" align="right">

<%
If Len(Request.Form("image3222")) > 0 Then

Dim sServer
Dim sLoginID
Dim sPassword
Dim sDate
Dim cn

'Get the Server and Login information
sServer = "xxxxxxxxxx
sLogin = "xxxxxxx"
sPassword = "xxxxxxxxx"
sDate = Now()
'Create a connection object
Set cn = Server.CreateObject("ADODB.Connection")
'Open a connection; the string refers to the DSN
cn.ConnectionString = "provider=sqloledb;SERVER=" & sServer & ";USER ID=" & sLogin & ";PWD=" & sPassword & ";DATABASE=Reservation"

cn.Open
sql="INSERT INTO searchResults (Type,SearchCity,"
sql=sql & "SearchCIDate,SearchCODate,SearchRooms,SearchUserName,SearchUserID,SearchTimeStamp)"
sql=sql & " VALUES "
sql=sql & "('" & 20 & "',"
sql=sql & "'" & (dictHotelReservationProfile("HotelCity")) & "',"
sql=sql & "'" & cDate(dictHotelReservationProfile("CIDate")) & "',"
sql=sql & "'" & cDate(dictHotelReservationProfile("CODate")) & "',"
sql=sql & "'" & dictHotelReservationProfile("NumberRooms") & "',"
sql=sql & "'" & Session("Username") & "',"
sql=sql & "'" & Session("UserID") & "',"
sql=sql & "'" & sDate & "')"

on error resume next

cn.Execute sql

if err<>0 then
end if

cn.close
Set cn = Nothing
end if
%>
 
Since you say it works when you remove your "if" block, that tells me the problem you are having is submitting the form correctly.

Post the HTML you have for your form and the button you click on, then we can see what is going on.

[monkey][snake] <.
 
Hi monksnake,

There is so much html and code that I didnt want to post it all. Below is forms tag and button that I want to use.

If you need morr code all post it all.

Thanks for the help.



<form method="POST" action="../scriptshrn/hotels_search.asp?MoreCities=<%= Request("MoreCities") %>" id=form1 name=form1>

<input type="image" src="../Images/submit_radio.gif" width="70" height="25" border="0" name="image3222" align="right">

<form/>
 
Do this.

Put a hidden <input> in your form and reference that on the other side

HTML
Code:
<form method="POST" action="../scriptshrn/hotels_search.asp?MoreCities=<%= Request("MoreCities") %>" id=form1 name=form1>

[!]<input type="hidden" value="submitted" name="submitCheck" />[/!]
<input type="image" src="../Images/submit_radio.gif" width="70" height="25" border="0" name="image3222" align="right">

</form>


ASP
Code:
[!]If (Request.Form("submitCheck").count) > 0 Then[/!]

Dim sServer
Dim sLoginID
Dim sPassword
Dim sDate
...
...





[monkey][snake] <.
 
Nope,

I changed the code and nothing.

This is so fustrating coming from asp.net were I could do this so easy and with classic asp I am so lost.

Does it have something to do with redirect?

Thanks for the help
 
wait a second, I think I know what it is.


It's this:

<form/>



Close your form tag properly and I believe it should work.

</form>

[monkey][snake] <.
 
Sorry, that was typo on my part with </form> in the code it was proper syntax.

What if I check for request string when it goes to the next page?

I tired to query URL string but its hidden I think this is the best way.

Dim clicked
clicked = Trim( "" & Request ("MoreCities") )
If clicked <> "" Then
'do something
End If


<form method="POST" action="../scriptshrn/hotels_search.asp?MoreCities=<%= Request("MoreCities") %>" id=form1 name=form1>

<form/>

Thanks
 
Request.QueryString is the syntax you use to grab values from the query string.

So you may want to put

Request.QueryString("MoreCities") instead of


Request("MoreCities")

[monkey][snake] <.
 
Well Iam out of ideas.

That didnt work.

Anything else I can try?

Thanks
 
Here you go, I tried to remove as much asp as I could.

Thanks


&lt;!--#include file=&quot;../IncludeFiles/setup.inc&quot;--&gt;
&lt;!--#include file=&quot;../IncludeFiles/functions.inc&quot;--&gt;

&lt;form method=&quot;POST&quot; action=&quot;../scriptshrn/hotels_search.asp?MoreCities=&lt;%= Request(&quot;MoreCities&quot;) %&gt;&quot; id=form1 name=form1&gt;
&lt;table width=&quot;610&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;410&quot;&gt;
&lt;table width=&quot;400&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot; bordercolor=&quot;#9966CC&quot; align=&quot;center&quot; height=&quot;175&quot;&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tr&gt;
&lt;td bgcolor=&quot;#4E107F&quot;&gt;
&lt;center&gt;
&lt;font color=&quot;#FFFFFF&quot;&gt;&lt;b&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;&gt;RATES
&amp; AVAILABILITY&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;hr width=&quot;380&quot; size=&quot;1&quot;&gt;
&lt;table width=&quot;400&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot; height=&quot;90&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;10&quot;&gt; &lt;/td&gt;
&lt;td width=&quot;150&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Destination
City:&lt;/font&gt;&lt;/td&gt;
&lt;td width=&quot;75&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Check-in:
&lt;/font&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td width=&quot;85&quot;&gt;&lt;b&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Month
/ Year&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td width=&quot;50&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Calendar&lt;/font&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;10&quot; height=&quot;20&quot;&gt; &lt;/td&gt;
&lt;td width=&quot;150&quot; height=&quot;20&quot;&gt;
&lt;select name=&quot;HotelCity&quot;&gt;
&lt;option value=&quot;LAS&quot; &lt;% If strCurrHotelCity = &quot;LAS&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Las Vegas, NV
&lt;!-- &lt;option value=&quot;ANA&quot; &lt;% If strCurrHotelCity = &quot;ANA&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Anaheim, CA
&lt;option value=&quot;DEN&quot; &lt;% If strCurrHotelCity = &quot;DEN&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Denver, CO
&lt;option value=&quot;FTL&quot; &lt;% If strCurrHotelCity = &quot;FTL&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Ft. Lauderdale, FL
&lt;option value=&quot;HNL&quot; &lt;% If strCurrHotelCity = &quot;HNL&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Hawaiian Islands, HI
&lt;option value=&quot;LAS&quot; &lt;% If strCurrHotelCity = &quot;LAS&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Las Vegas, NV
&lt;option value=&quot;IFP&quot; &lt;% If strCurrHotelCity = &quot;IFP&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Laughlin, NV
&lt;option value=&quot;LAX&quot; &lt;% If strCurrHotelCity = &quot;LAX&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Los Angeles, CA
&lt;option value=&quot;MIA&quot; &lt;% If strCurrHotelCity = &quot;MIA&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Miami, FL
&lt;option value=&quot;MSY&quot; &lt;% If strCurrHotelCity = &quot;MSY&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;New Orleans, LA
&lt;option value=&quot;NYC&quot; &lt;% If strCurrHotelCity = &quot;NYC&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;New York City, NY
&lt;option value=&quot;ORL&quot; &lt;% If strCurrHotelCity = &quot;ORL&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Orlando, FL
&lt;option value=&quot;PSP&quot; &lt;% If strCurrHotelCity = &quot;PSP&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Palm Springs, CA
&lt;option value=&quot;PHX&quot; &lt;% If strCurrHotelCity = &quot;PHX&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Phoenix, AZ
&lt;option value=&quot;PRM&quot; &lt;% If strCurrHotelCity = &quot;PRM&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Primm/StateLine, NV
&lt;option value=&quot;RNO&quot; &lt;% If strCurrHotelCity = &quot;RNO&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Reno, NV
&lt;option value=&quot;SAN&quot; &lt;% If strCurrHotelCity = &quot;SAN&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;San Diego, CA
&lt;option value=&quot;SFO&quot; &lt;% If strCurrHotelCity = &quot;SFO&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;San Francisco, CA
&lt;option value=&quot;SEA&quot; &lt;% If strCurrHotelCity = &quot;SEA&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Seattle, WA --&gt;
&lt;%
End If
%&gt;
&lt;/select&gt;
&lt;%
Else
%&gt;
&lt;font face=&quot;Arial, Helvetica, sans-serif&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/font&gt;
&lt;%
End If
%&gt;
&lt;/td&gt;
&lt;td width=&quot;75&quot; height=&quot;20&quot;&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;%
Call SubDay(&quot;CIDay&quot;,strCurrCIDate)
%&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td width=&quot;85&quot; height=&quot;20&quot;&gt;
&lt;%
Call SubCreateArrayToSubSpecial(&quot;CIMonth&quot;,Date,Month
(strCurrCIDate))
%&gt;
&lt;/td&gt;
&lt;td width=&quot;50&quot; height=&quot;20&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;a href=&quot;javascript:&quot; onClick=&quot;NewWin=window.open('/scriptshrn/callendar.asp?
ObjName=CI&amp;DefoultDate=&lt;%= Date %&gt;&amp;CalBackground=?9966CC&amp;CalArrowBackground=?9999CC&amp;
CalBorder=?4E107F','callendar','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,resizable
=no,copyhistory=yes,width=160,height=147,left=400,top=250')
;&quot;&gt;
&lt;img src=&quot;/Images/calendar_hotels.jpg&quot; width=&quot;34&quot; height=&quot;22&quot; border=&quot;0&quot;&gt;
&lt;/a&gt; &lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;10&quot;&gt;
&lt;div align=&quot;left&quot;&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt; Number
of rooms:&lt;/font&gt;&lt;/td&gt;
&lt;td width=&quot;75&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Check-out:
&lt;/font&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td width=&quot;85&quot;&gt;&lt;b&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Month
/ Year&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td width=&quot;50&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Calendar&lt;/font&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;10&quot; height=&quot;20&quot;&gt; &lt;/td&gt;
&lt;td width=&quot;150&quot; height=&quot;20&quot;&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;%
Call SubNumber(&quot;NumberRooms&quot;,strCurrRoomsNum,1,6,&quot;&quot;)
%&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td width=&quot;75&quot; height=&quot;20&quot;&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;%
Call SubDay(&quot;CODay&quot;,strCurrCODate)
%&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td width=&quot;85&quot; height=&quot;20&quot;&gt;
&lt;%
Call SubCreateArrayToSubSpecial(&quot;COMonth&quot;,Date+1,
Month(strCurrCODate))
%&gt;
&lt;/td&gt;
&lt;td width=&quot;50&quot; height=&quot;20&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;a href=&quot;javascript:&quot; onClick=&quot;NewWin=window.open('/scriptshrn/callendar.asp?
ObjName=CO&amp;DefoultDate=&lt;%= Date+1 %&gt;&amp;CalBackground=?9966CC&amp;CalArrowBackground=?9999CC&amp;
CalBorder=?4E107F','callendar','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,resizable
=no,copyhistory=yes,width=160,height=147,left=400,top=250')
;&quot;&gt;
&lt;img src=&quot;/Images/calendar_hotels.jpg&quot; width=&quot;34&quot; height=&quot;22&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;table width=&quot;400&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;10&quot;&gt; &lt;/td&gt;
&lt;td width=&quot;10&quot;&gt;
&lt;input type=&quot;radio&quot; name=&quot;SearchBy&quot; value=&quot;AllHotels&quot; &lt;%= strCheckedAllHotels %&gt;&gt;
&lt;/td&gt;
&lt;td width=&quot;60&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;All
hotels&lt;/font&gt;&lt;/td&gt;
&lt;td width=&quot;27&quot;&gt;
&lt;input type=&quot;radio&quot; name=&quot;SearchBy&quot; value=&quot;AvailableHotels&quot; &lt;%= strCheckedAvailableHotels %&gt;&gt;
&lt;/td&gt;
&lt;td width=&quot;90&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Available
hotels &lt;/font&gt;&lt;/td&gt;
&lt;td width=&quot;10&quot;&gt;
&lt;input type=&quot;radio&quot; name=&quot;SearchBy&quot; value=&quot;HotelsByPrice&quot; &lt;%= strCheckedHotelsByPrice %&gt;&gt;
&lt;/td&gt;
&lt;td width=&quot;193&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Available
hotels by price&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;table width=&quot;400&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;310&quot; align=&quot;right&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;
&lt;%
If dictPersonalProfile(&quot;UserType&quot;) = 5 Or dictPersonalProfile(&quot;UserType&quot;) = 9 Then
Response.Write (&quot;Discount: &quot;)
Call SubNumber(&quot;DiscountPercent&quot;,cInt(dictPersonalProfile
(&quot;DiscountPercent&quot;)),0,10,&quot;%&quot;)
Else
Response.Write (&quot;&lt;input type='hidden' name='DiscountPercent' value='&quot; &amp; dictPersonalProfile(&quot;DiscountPercent&quot;) &amp; &quot;'&gt;&quot;)
End If
%&gt;
&lt;/font&gt;&lt;/td&gt;
&lt;td width=&quot;90&quot;&gt;
&lt;div align=&quot;right&quot;&gt;
&lt;input type=&quot;image&quot; src=&quot;../Images/submit_radio.gif&quot; width=&quot;70&quot; height=&quot;25&quot; border=&quot;0&quot; name=&quot;image3222&quot; align=&quot;right&quot;&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;td valign=&quot;middle&quot;&gt;
&lt;%
If LCase(strLinkMoreHotels) = &quot;/scripts/admin_menu_main.asp&quot; Then
intWidth = 175
Else
intWidth = 200
End If
%&gt;
&lt;table width=&quot;&lt;%= intWidth %&gt;&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot; bordercolor=&quot;#9966CC&quot; height=&quot;175&quot;&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; height=&quot;155&quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;&lt;%= intWidth %&gt;&quot; bgcolor=&quot;#9966CC&quot;&gt;
&lt;center&gt;
&lt;b&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;&gt;
&lt;% If Request(&quot;Dest&quot;) &lt;&gt; &quot;&quot; Then Response.Write (dictHotelReservationProfile(&quot;HotelCity&quot;) &amp; &quot;, &quot; &amp; dictHotelReservationProfile(&quot;HotelState&quot;)) %&gt;

&lt;%
Dim objRSFromtblPhoneTrack, sqlFromtblPhoneTrack
Set objRSFromtblPhoneTrack = Server.CreateObject (&quot;ADODB.Recordset&quot;)
sqlFromtblPhoneTrack = &quot;Select CallAnswered From tblPhoneTrack Where CallAnswered = 0&quot;
objRSFromtblPhoneTrack.Open sqlFromtblPhoneTrack,objConnectionToNewReservation,1,3
If (dictPersonalProfile(&quot;UserType&quot;) = 5 Or dictPersonalProfile(&quot;UserType&quot;) = 9) And objRSFromtblPhoneTrack.RecordCount &gt; 0 Then
%&gt;
&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; width=&quot;110&quot; height=&quot;18&quot;&gt;
&lt;param name=movie value=&quot;../images/i4veags_message_alert.swf&quot;&gt;
&lt;param name=quality value=high&gt;
&lt;embed src=&quot;../images/i4veags_message_alert.swf&quot; quality=high type=&quot;application/x-shockwave-flash&quot; width=&quot;110&quot; height=&quot;18&quot;&gt;
&lt;/embed&gt;
&lt;/object&gt;
&lt;%
End If

%&gt;
&lt;/font&gt;&lt;/b&gt;
&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;hr width=&quot;&lt;%= intWidth-5 %&gt;&quot; size=&quot;1&quot;&gt;
&lt;table width=&quot;&lt;%= intWidth %&gt;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;110&quot;&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td width=&quot;&lt;%= intWidth %&gt;&quot; background=&quot;../images/world_1.gif&quot; align=&quot;center&quot;&gt;
&lt;%
If cBool(dictPersonalProfile(&quot;PKG001&quot;)) Then Response.Write (&quot;&lt;div align=&quot;&quot;left&quot;&quot;&gt;&lt;a href=&quot;&quot; &amp; dictPersonalProfile(&quot;UserName&quot;) &amp; dictPersonalProfile(&quot;UserID&quot;) &amp; &quot;&quot;&quot;&gt;&lt;img src=&quot;&quot;../images/internalpackages.gif&quot;&quot; border=0 width=&quot;&quot;175&quot;&quot; height=&quot;&quot;66&quot;&quot;&gt;&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;&quot;)
'If cBool(dictPersonalProfile(&quot;PKG001&quot;)) Then Response.Write (&quot;&lt;div align=&quot;&quot;left&quot;&quot;&gt;&lt;a href=&quot;&quot; &amp; dictPersonalProfile(&quot;UserName&quot;) &amp; dictPersonalProfile(&quot;UserID&quot;) &amp; &quot;&quot;&quot;&gt;&lt;img src=&quot;&quot;../images/internalpackages.gif&quot;&quot; border=0 width=&quot;&quot;175&quot;&quot; height=&quot;&quot;66&quot;&quot;&gt;&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;&quot;)

If (dictPersonalProfile(&quot;UserType&quot;) = 5 Or dictPersonalProfile(&quot;UserType&quot;) = 9) And objRSFromtblPhoneTrack.RecordCount &gt; 0 Then
%&gt;
&lt;a href=&quot;javascript:&quot; onClick=&quot;NewWin=window.open('/scripts/reports/phonetrack.
asp','phonetrack','toolbar=no,location=no,directories=no,
status=no,menubar=no,scrollbars=yes,resizable=no,
copyhistory=yes,width=760,height=400,left=0,top=0');&quot;&gt;
&lt;img src=&quot;../images/i4veags_alert_image.gif&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;font class=&quot;dsmltext&quot;&gt;New Calls in the system&lt;br&gt;click here for customer listing&lt;/font&gt;&lt;/a&gt;

&lt;%
End If
objRSFromtblPhoneTrack.Close
Set objRSFromtblPhoneTrack = Nothing
%&gt;
&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;%
Else
%&gt;
&lt;table width=&quot;610&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot; bordercolor=&quot;#9966CC&quot;&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot; height=&quot;10&quot;&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot; height=&quot;10&quot; bgcolor=&quot;#4E107F&quot;&gt;
&lt;center&gt;
&lt;b&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;&gt;Search
Hotel Rates &amp; Availability&lt;/font&gt;&lt;/b&gt;
&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;%
If ReQuest(&quot;Message&quot;) &lt;&gt; &quot;&quot; Then
%&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot; height=&quot;10&quot;&gt;
&lt;tr bgcolor=&quot;#4E107F&quot;&gt;
&lt;td colspan=&quot;2&quot; height=&quot;10&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-1&quot; color=&quot;red&quot;&gt;&lt;b&gt; &lt;%= UCase(Request(&quot;Message&quot;)) %&gt;&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;%
End If
%&gt;
&lt;hr width=&quot;600&quot; size=&quot;1&quot;&gt;
&lt;table width=&quot;600&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;10&quot; bgcolor=&quot;4E107F&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;font color=&quot;#FFFFFF&quot; size=&quot;-2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;&gt;&lt;b&gt;1&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td width=&quot;590&quot; bgcolor=&quot;#F8F0FF&quot;&gt;&lt;font size=&quot;-2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;&gt;&lt;b&gt;Search
hotel rates availability&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;table width=&quot;600&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; height=&quot;100&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;452&quot;&gt;
&lt;table width=&quot;415&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot; height=&quot;90&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;20&quot;&gt; &lt;/td&gt;
&lt;td width=&quot;150&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Destination City:&lt;/font&gt;&lt;/td&gt;
&lt;td width=&quot;90&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Check-in:&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td width=&quot;90&quot;&gt;&lt;b&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Month / Year&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td width=&quot;65&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Calendar&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;20&quot; height=&quot;20&quot;&gt; &lt;/td&gt;
&lt;td width=&quot;150&quot; height=&quot;20&quot;&gt;
&lt;%
'If Request(&quot;MoreCities&quot;) = &quot;&quot; Then
If strLinkMoreHotels &lt;&gt; &quot;/scripts/cities.asp&quot; Then
%&gt;
&lt;select name=&quot;HotelCity&quot;&gt;
&lt;option value=&quot;ANA&quot; &lt;% If strCurrHotelCity = &quot;ANA&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Anaheim, CA
&lt;option value=&quot;DEN&quot; &lt;% If strCurrHotelCity = &quot;DEN&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Denver, CO
&lt;option value=&quot;FTL&quot; &lt;% If strCurrHotelCity = &quot;FTL&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Ft. Lauderdale, FL
&lt;option value=&quot;HNL&quot; &lt;% If strCurrHotelCity = &quot;HNL&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Hawaiian Islands, HI
&lt;option value=&quot;LAS&quot; &lt;% If strCurrHotelCity = &quot;LAS&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Las Vegas, NV
&lt;option value=&quot;IFP&quot; &lt;% If strCurrHotelCity = &quot;IFP&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Laughlin, NV
&lt;option value=&quot;LAX&quot; &lt;% If strCurrHotelCity = &quot;LAX&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Los Angeles, CA
&lt;option value=&quot;MIA&quot; &lt;% If strCurrHotelCity = &quot;MIA&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Miami, FL
&lt;option value=&quot;MSY&quot; &lt;% If strCurrHotelCity = &quot;MSY&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;New Orleans, LA
&lt;option value=&quot;NYC&quot; &lt;% If strCurrHotelCity = &quot;NYC&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;New York City, NY
&lt;option value=&quot;ORL&quot; &lt;% If strCurrHotelCity = &quot;ORL&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Orlando, FL
&lt;option value=&quot;PRM&quot; &lt;% If strCurrHotelCity = &quot;PRM&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Primm/StateLine, NV
&lt;option value=&quot;RNO&quot; &lt;% If strCurrHotelCity = &quot;RNO&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Reno, NV
&lt;option value=&quot;SAN&quot; &lt;% If strCurrHotelCity = &quot;SAN&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;San Diego, CA
&lt;option value=&quot;SFO&quot; &lt;% If strCurrHotelCity = &quot;SFO&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;San Francisco, CA
&lt;option value=&quot;SEA&quot; &lt;% If strCurrHotelCity = &quot;SEA&quot; Then Response.Write (&quot;Selected&quot;) %&gt;&gt;Seattle, WA
&lt;/select&gt;
&lt;%
Else
Call SubHRNCityFromDataBase(&quot;HotelCity&quot;,strCurrHotelCity)
End If
%&gt;
&lt;/td&gt;
&lt;td width=&quot;90&quot; height=&quot;20&quot;&gt;&lt;div align=&quot;center&quot;&gt;
&lt;%
Call SubDay(&quot;CIDay&quot;,strCurrCIDate)
%&gt;
&lt;/div&gt;&lt;/td&gt;
&lt;td width=&quot;90&quot; height=&quot;20&quot;&gt;
&lt;%
Call SubCreateArrayToSubSpecial(&quot;CIMonth&quot;,Date,Month
(strCurrCIDate))
%&gt;
&lt;/td&gt;
&lt;td width=&quot;65&quot; height=&quot;20&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;a href=&quot;javascript:&quot; onClick=&quot;NewWin=window.open('/scriptshrn/callendar.asp?
ObjName=CI&amp;DefoultDate=&lt;%= Date %&gt;&amp;CalBackground=?9966CC&amp;CalArrowBackground=?9999CC&amp;
CalBorder=?4E107F','callendar','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,resizable
=no,copyhistory=yes,width=160,height=147,left=400,top=250')
;&quot;&gt;
&lt;img src=&quot;/Images/calendar_hotels.jpg&quot; width=&quot;34&quot; height=&quot;22&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt;&lt;div align=&quot;left&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt; Number of rooms:&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td width=&quot;90&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Check-out:&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td width=&quot;90&quot;&gt;&lt;b&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Month / Year&lt;/font&gt;&lt;/b&gt;&lt;/td&gt;
&lt;td width=&quot;65&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Calendar&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width=&quot;20&quot; height=&quot;20&quot;&gt; &lt;/td&gt;
&lt;td width=&quot;150&quot; height=&quot;20&quot;&gt;&lt;div align=&quot;center&quot;&gt;
&lt;%
Call SubNumber(&quot;NumberRooms&quot;,strCurrRoomsNum,1,6,&quot;&quot;)
%&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td width=&quot;90&quot; height=&quot;20&quot;&gt;&lt;div align=&quot;center&quot;&gt;
&lt;%
Call SubDay(&quot;CODay&quot;,strCurrCODate)
%&gt;
&lt;/div&gt;&lt;/td&gt;
&lt;td width=&quot;90&quot; height=&quot;20&quot;&gt;
&lt;%
Call SubCreateArrayToSubSpecial(&quot;COMonth&quot;,Date+1,Month
(strCurrCODate))
%&gt;
&lt;/td&gt;
&lt;td width=&quot;65&quot; height=&quot;20&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;a href=&quot;javascript:&quot; onClick=&quot;NewWin=window.open('/scriptshrn/callendar.asp?
ObjName=CO&amp;DefoultDate=&lt;%= Date+1 %&gt;&amp;CalBackground=?9966CC&amp;CalArrowBackground=?9999CC&amp;
CalBorder=?4E107F','callendar','toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,resizable
=no,copyhistory=yes,width=160,height=147,left=400,top=250')
;&quot;&gt;
&lt;img src=&quot;/Images/calendar_hotels.jpg&quot; width=&quot;34&quot; height=&quot;22&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;td width=&quot;150&quot; background=&quot;../images/world_1.gif&quot;&gt;
&lt;center&gt;
&lt;%
'If Request(&quot;MoreCities&quot;) = &quot;&quot; Then
If strLinkMoreHotels &lt;&gt; &quot;/scripts/cities.asp&quot; Then
'Response.Write (&quot;&lt;a href='&quot; &amp; strLinkMoreHotels &amp; &quot;?MoreCities=yes'&gt;&quot;)
Response.Write (&quot;&lt;a href='/scripts/cities.asp'&gt;&quot;)
%&gt;
&lt;font face=&quot;Verdana, Arial, Helvetica, sans-serif&quot; size=&quot;-1&quot;&gt;&lt;b&gt;More
Cites&lt;/b&gt;&lt;/font&gt; &lt;img src=&quot;../Images/more_arrow.gif&quot; width=&quot;18&quot; height=&quot;15&quot; border=&quot;0&quot; name=&quot;image44&quot;&gt;
&lt;%
Response.Write (&quot;&lt;/a&gt;&quot;)
End If
%&gt;
&lt;/center&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;table width=&quot;600&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;510&quot;&gt;
&lt;table width=&quot;520&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;10&quot; bgcolor=&quot;4E107F&quot;&gt;
&lt;div align=&quot;center&quot;&gt;&lt;font color=&quot;#FFFFFF&quot; size=&quot;-2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;&gt;&lt;b&gt;2&lt;/b&gt;&lt;/font&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td width=&quot;590&quot; bgcolor=&quot;#F8F0FF&quot;&gt;&lt;font size=&quot;-2&quot; face=&quot;Verdana, Arial, Helvetica, sans-serif&quot;&gt;&lt;b&gt;How
would you like to view your search results?&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;table width=&quot;520&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;20&quot;&gt; &lt;/td&gt;
&lt;td width=&quot;10&quot;&gt;
&lt;input type=&quot;radio&quot; name=&quot;SearchBy&quot; value=&quot;AllHotels&quot; &lt;%= strCheckedAllHotels %&gt;&gt;
&lt;/td&gt;
&lt;td width=&quot;150&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;All
hotels&lt;/font&gt;&lt;/td&gt;
&lt;td width=&quot;10&quot;&gt;
&lt;input type=&quot;radio&quot; name=&quot;SearchBy&quot; value=&quot;AvailableHotels&quot; &lt;%= strCheckedAvailableHotels %&gt;&gt;
&lt;/td&gt;
&lt;td width=&quot;150&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Available
hotels &lt;/font&gt;&lt;/td&gt;
&lt;td width=&quot;10&quot;&gt;
&lt;input type=&quot;radio&quot; name=&quot;SearchBy&quot; value=&quot;HotelsByPrice&quot; &lt;%= strCheckedHotelsByPrice %&gt;&gt;
&lt;/td&gt;
&lt;td width=&quot;150&quot;&gt;&lt;font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-2&quot;&gt;Available
hotels by price&lt;/font&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;td width=&quot;80&quot; valign=&quot;top&quot;&gt;
&lt;div align=&quot;right&quot;&gt;
&lt;input type=&quot;image&quot; src=&quot;../Images/submit_radio.gif&quot; width=&quot;70&quot; height=&quot;25&quot; border=&quot;0&quot; name=&quot;image32&quot; align=&quot;top&quot;&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
 
Since your using an image in the button I believe you need to add the '.x' to the code

Code:
If Len(Request.Form("image3222.x")) > 0 Then

Hope this helps.
 
Is this page the hotels_search.asp page your referencing in your form tag, or is that another page?


Also, using request instead of Request.QueryString does work. When you use just Request it searches through the Request.Form, QueryString, Cookies collections to find your key. It is better to be specific when you can because the code will be more efficienct (i.e., Request.QueryString instead of just Request) but it is not a requirement.

 
Hi again,

I have tried everything have everyone has suggest and I still can get it to work. So I am trying to call SUB from vbscript to make the connect and insert data after image button is click. I cannot do request.query or request.form I think it because they are masking the URL with default so I cannot query value from URL. So I was thinking that I could run SUB from onclick but thats not working either.

thanks

below is my code.



<script language="vbscript">
sub GetUserName()
Dim sServer
Dim sLoginID
Dim sPassword
Dim sDate
Dim cn

'Get the Server and Login information
sServer = "xxxxxxx;"
sLogin = "xxxxxx"
sPassword = "xxxxxxx"
sDate = Now()
'Create a connection object
Set cn = Server.CreateObject("ADODB.Connection")
'Open a connection; the string refers to the DSN
cn.ConnectionString = "provider=sqloledb;SERVER=" & sServer & ";USER ID=" & sLogin & ";PWD=" &sPassword & ";DATABASE=Reservation"

cn.Open
sql="INSERT INTO XXXXX (Type,SearchCity,"
sql=sql & "SearchCIDate,SearchCODate,SearchRooms,SearchUserName,SearchUserID,SearchTimeStamp)"
sql=sql & " VALUES "
sql=sql & "('" & 20 & "',"
sql=sql & "'" & dictHotelReservationProfile("HotelCity") & "',"
sql=sql & "'" & cDate(dictHotelReservationProfile("CIDate")) & "',"
sql=sql & "'" & cDate(dictHotelReservationProfile("CODate")) & "',"
sql=sql & "'" & dictHotelReservationProfile("NumberRooms") & "',"
sql=sql & "'" & Session("Username") & "',"
sql=sql & "'" & Session("UserID") & "',"
sql=sql & "'" & sDate & "')"

cn.Execute sql


cn.close
Set cn = Nothing

end sub
</script>


<input onclick="Call GetUserName()" value="submit" type="image" src="../Images/submit_radio.gif" width="70" height="25" border="0" name="image3222" align="right">
 
If you're using this sub as a client-side function, then it won't work as you wish because you are attempting to call the server - which you cannot do from client-side code. If you wish to do this, you will need to do it from ASP (which is what you appear to have been trying to do in your original post).

But something else stands out to me. You indicate elsewhere in this thread that you are attempting to "redirect" to the page. If you use response.redirect instead of submitting the form, you will not find any of your form values because the form was never submitted. I vaguely recall that using an image button does not necessarily "submit" the form (though I may be wrong, it's been a while since I've had to do something like that). So my question is exactly how do you submit the page (or what does the user click in order to go from one page to the next)? This may help find where your problem lies.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top