ASP / VB Assistance
#1
I have an ASP form with a selection box populated via an SQL table. Some of the options have a section of text at the end of the string which I need to delete before the data is passed to the next page.
E.G. If the string from the dataase reads
Extorsion e.g. illegal emails requiring payment.
Then I need the data from the form field, being POST'd to the next form to just be 'Extorsion', not the 'e.g. illegal emails requiring payment.'
I suspect it has something to do with strdelete or strwhere, but i've had no real experience with these commands.
As each result will have the 'e.g. Unrequired data' it will be everything before th e.g. which I need to keep.
I hope this is clear??? , but you know when you have it in your head but can't explain
Thanx.
Rik.
E.G. If the string from the dataase reads
Extorsion e.g. illegal emails requiring payment.
Then I need the data from the form field, being POST'd to the next form to just be 'Extorsion', not the 'e.g. illegal emails requiring payment.'
I suspect it has something to do with strdelete or strwhere, but i've had no real experience with these commands.
As each result will have the 'e.g. Unrequired data' it will be everything before th e.g. which I need to keep.
I hope this is clear??? , but you know when you have it in your head but can't explain
Thanx.
Rik.
#6
Little problem,
I have a variable 'threat1=request.form("threat")' which holds the data 'Extorsion e.g. illegal emails requiring payment.'
I've used your code as follows: 'threat = Left$(threat1, InStr(threat1, "e.g."))' to hopefully pass the variable 'threat' to the next page without the e.g. illegal emails requiring payment.'
When I submit the form it errors: Error Type:
Microsoft VBScript compilation (0x800A0408)
Invalid character
/new_cit/risk/vulnerabilities/vulnerabilities1.asp, line 29, column 13'
I take the $ out of the code and it passes 'Capacity Overload e' as the edited variable. It won't delete the final e, any ideas??
I have a variable 'threat1=request.form("threat")' which holds the data 'Extorsion e.g. illegal emails requiring payment.'
I've used your code as follows: 'threat = Left$(threat1, InStr(threat1, "e.g."))' to hopefully pass the variable 'threat' to the next page without the e.g. illegal emails requiring payment.'
When I submit the form it errors: Error Type:
Microsoft VBScript compilation (0x800A0408)
Invalid character
/new_cit/risk/vulnerabilities/vulnerabilities1.asp, line 29, column 13'
I take the $ out of the code and it passes 'Capacity Overload e' as the edited variable. It won't delete the final e, any ideas??
#7
Adding a space to "e.g" worked for me: InStr(threat1, " e.g."))
Leaves a space though so just trim it: trim(InStr(threat1, " e.g.")))
I've never seen $ used in VBScript, just PHP, Perl etc.
Leaves a space though so just trim it: trim(InStr(threat1, " e.g.")))
I've never seen $ used in VBScript, just PHP, Perl etc.
Trending Topics
#8
Sorry to be a pain, but some of the options don't have the 'e.g.' at the end, so if you select one that doesn't at the moment it deletes everthing. How can I check to see if e.g. exists in the string and then delete the data if it does.
thanx.
thanx.
#9
Scooby Regular
Can you not separate the content into a new table? i.e. have a new table with all the e.g. bits in, then just link them together when doing the initial recordset for the form.
Otherwise, just do an If(Instr(e.g.))= true then delete else, dont delete, end if etc
Cant be ased typing full syntax, but you get the drift.
Otherwise, just do an If(Instr(e.g.))= true then delete else, dont delete, end if etc
Cant be ased typing full syntax, but you get the drift.
Thread
Thread Starter
Forum
Replies
Last Post