Hi all, these are the problem i face and i have no idea how i should over come it. I need to direct the user to paypal page when he click the button order, in the mean while i need to call a function to select the Unique ID that is supposedly pass to paypal. But Paypal could not read it. the following is my coding:

<%
sub CreateID()
'some coding here to insert some data into database
dim ItemID
ItemID = "12345"
end sub
%>

<form name="RegForm" onSubmit="<%CreateID()%>" action="(URL address blocked: See forum rules)" method="post"style="margin: 0px;">
''some coding here
<input type="hidden" name="item_number" value="<%= ItemID %>">
</form>

But Paypal could not read it. The second Problem is the page call the CreateID when the page load instead of when the user click the order button.Can some one teach me what should I do?
Any help would be appreciated. Thx