Anybody know what the Perl syntax would be to allow the characters "http://" to be the default value in the URL field on my form ( http://www.usedflutes.com/addpage.html ). Needs to be configured so that if someone chooses not to post a URL (field is optional), would strip the "http://" so that the field would post as empty?
>Then either the value was not actually 'http://' or the code I gave was inserted to late >in the program.
The "http://" comes from the form http://www.usedflutes.com/addpage_URL.html so I don't think that was the problem. As for placement, I did put it up towards the beginning so not sure about that either.
>If you consider the example:
code:
------------------------------------------------------------------------
$FORM{url} = 'http://';
delete $FORM{url} if $FORM{url} eq 'http://';
print $FORM{url};
------------------------------------------------------------------------
nothing will be printed.
OK, I'll try this and see. What I'm really looking for however, is to have the "http://" only stripped if there's nothing added to it. If someone adds to the http:// , then I want that UEL value to go through. Any ideas how to set that up?
bobafifi As for placement, I did put it up towards the beginning
That's a very broad statement and doesn't tell me a whole lot. It has to go somewhere after the parameters are parsed and before it is printed to GUEST.
What I'm really looking for however, is to have the "http://" only stripped if there's nothing added to it. If someone adds to the http:// , then I want that UEL value to go through. Any ideas how to set that up?
Yeah, what I already gave you.
OK - I just tried your new code, but no luck there either sorry to say
The new code I gave was merely an example and not meant to be the solution.
Hi Jeff,
My apologies...
I made the mistake of not slightly modifying your code so that it would be read right
(needed to change {url} to {'url'} ) and it works! :-) Thanks!
However, I've now got another problem with the code:
I use the script to send me INSERT statements for the MySQL database that I use. Since the {'url'} field is completely deleted if your code is activated, I lose the {'url'} field value for the INSERT statement and so the MySQL insert fails:
Hi Jeff,
<There must be something else that was changed because there is no difference between those two.
Well yes, I did change the "eq" to "=" (eq consisitently failed to post) and provide curly braces before and after the code. Anyhow, I just installed your last code in a similar fashion which for some reason is also deleting the url completely - regardless of what text is in the url field. Not sure what's up, but that's what's happening.
bobafifi Anyhow, I just installed your last code in a similar fashion which for some reason is also deleting the url completely - regardless of what text is in the url field
That's because you changed eq to =, don't do that. The curly braces don't hurt it, but don't do anything either. If it still doesn't work then upload your modified script.
Hi Jeff,
OK, I can't figure it out...
If I leave the code 'as is,' code doesn't do anything - form processes as usual.
If I change the 'eq' to '=,' then the code works but removes the {'url'} field completely.
So anyhwow, here's the script:
Bookmarks