noname4thisguy Posted May 8, 2009 Share Posted May 8, 2009 Hi guys, newbie here. My boss is working on a site that's going to have a similar front page to match.com, and he wants to pass a variable in the url. I'm not exactly familiar with php, and i have no idea how to go about getting what he wants, all i have are a few examples of code. The site is in an iframe. say some one were to type the url www.sitename.com?c=google he wanted the SUBID in the iframed url below to change from this: http://sitename.website.com/p/memsearch.cgi?pid=g937931-pmo.subSUBID&ip=auto&show=T&find_item=7 to this http://sitename.website.com/p/memsearch.cgi?pid=g937931-pmo.subgoogle&ip=auto&show=T&find_item=7 then he sent me this: <form action="index.php" method="POST"> <input type="text" name="campaign"> <input type="submit"> </form> index.php http://sitename.website.com/p/memsearch.cgi?pid=g937931-pmo.sub<?php echo $_POST['campaign']; ?>&ip=auto&show=T&find_item=7 sitename.com/google.php google.php http://sitename.website.com/p/memsearch.cgi?pid=g937931-pmo.subgoogle&ip=auto&show=T&find_item=7 I hate to sound like a complete noob, but i was hoping someone here would be able to tell me exactly what he's going for and what i need to do to go about doing it. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 So the URL params you want to get are the ones in the iFrame page? Quote Link to comment Share on other sites More sharing options...
noname4thisguy Posted May 8, 2009 Author Share Posted May 8, 2009 I think so, I'm trying to get a hold of him so he can explain to me what he's trying to do exactly. Hope i'm not wasting anyone's time Quote Link to comment Share on other sites More sharing options...
noname4thisguy Posted May 8, 2009 Author Share Posted May 8, 2009 Alright here's what he said: sitename.com?c=google he want's whatever variable typed in that url, in this case "google"; http://trannydate.xmatch.com/p/memsearch.cgi?pid=g937931-pmo.subSUBID&ip=auto&show=T&find_sex=7 to replace "SUBID" Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 $_GET $c = $_GET['c']; echo $c; Like that? Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted May 8, 2009 Share Posted May 8, 2009 Alright here's what he said: sitename.com?c=google he want's whatever variable typed in that url, in this case "google"; http://trannydate.xmatch.com/p/memsearch.cgi?pid=g937931-pmo.subSUBID&ip=auto&show=T&find_sex=7 to replace "SUBID" Well to access the google variable, it would be $_GET['c']. That would equal: google Quote Link to comment Share on other sites More sharing options...
noname4thisguy Posted May 8, 2009 Author Share Posted May 8, 2009 So would it go something like this: index.php ----------------- <? php $campaign = $_POST(or GET)['campaign']; ?> index.html ------------------------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Tranny Date.com</title> </head> <form action="index.php" method="POST"> <input type="text" name="campaign"> <input type="submit"> </form> <center> <body> <iframe src="http://sitename.website.com/p/memsearch.cgi?pid=g937931-pmo.sub<?php echo $campaign; ?>&ip=auto&show=T&find_item=7" frameborder="0" width="100%" height="1800px"></iframe> </body> </center> </html> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 1. No, you can't put PHP inside a HTML file, that is unless you have .htaccess rewrite it. 2. Where did $_POST come from? 3. If you can specify the URL, why use PHP? Just put the text in the URL. Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted May 8, 2009 Share Posted May 8, 2009 So would it go something like this: index.php ----------------- <? php $campaign = $_POST(or GET)['campaign']; ?> index.html ------------------------------ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Tranny Date.com</title> </head> <form action="index.php" method="POST"> <input type="text" name="campaign"> <input type="submit"> </form> <center> <body> <iframe src="http://sitename.website.com/p/memsearch.cgi?pid=g937931-pmo.sub<?php echo $campaign; ?>&ip=auto&show=T&find_item=7" frameborder="0" width="100%" height="1800px"></iframe> </body> </center> </html> Yeah that should work but you have index.php and index.html. That's very confusing...at least for me...you should make one of them your main index file.... If you're not sure of your input, GET or POST you can always do REQUEST, it will cover you both ways, BUT it's not good practice so make sure you do know what type of input you are getting, but for testing purposes you can use REQUEST. $campaign = $_REQUEST['whatever_input']; Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted May 8, 2009 Share Posted May 8, 2009 1. No, you can't put PHP inside a HTML file, that is unless you have .htaccess rewrite it. That's right, I'm assuming that he has his web server parsing HTML as PHP..... Quote Link to comment Share on other sites More sharing options...
noname4thisguy Posted May 8, 2009 Author Share Posted May 8, 2009 Oh alright, i think we got it set, it works, but we'll know for sure once we have the front page up. Thanks for your help guys, really appreciate it Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted May 8, 2009 Share Posted May 8, 2009 No problem.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.