Hi, I really know nothing about php, so maybe you guys can help me I have this form <form name="my_form" method="get" action="http://websitehere.com"> <input type="hidden" name="q" value="" id="url_input" /> <input type="hidden" name="hl" value="" /> Code (markup): And I want replace the "http://websitehere.com" by 5 different random urls like "http://1websitehere.com" and "http://2websitehere.com" and "http://3websitehere.com" so on.. Even better I could put "weight" in them so 1 url will show more often.. probably this can be done by php or java? I dont know
nope, I just want to randomize the action= Code (markup): I want it to sometimes be http://websitehere.com, sometimes http://1websitehere.com sometimes http://2websitehere.com etc..
I'm bad at php and too lazy now (I'm on holidays!) to modify it for you, but here http://www.alistapart.com/articles/randomizer/ you can find a tutorial on how to make a image random via php. If you a know just a bit on programming will be really easy to modify so it fits your requirements.
I have to make an assumption here. A php file generates that html and you can put a variable in the action element of the form tag. $urls = array( "http://www.example.com/1/", "http://www.example.com/2/", "http://www.example.com/3/", ); $url = $urls[rand(0,count($urls)-1)]; echo "<form name=\"my_form\" method=\"get\" action=\"$url\">"; PHP: Quick idea. Not tested.
I was writting a reply with some code that should also work, but the one posted while I was writting looks better (I'm pretty sure it will work) so go ahead and try it.
Sorry to resurrect an old thread, but this is exactly the kind of script I need - except I need to add weight to the urls, and I want to be able to do it some way other than having multiple entries of the same url in the array. Please help the newbie!