Jump to content

Variables in URL


Recommended Posts

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.

 

 

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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>

 

Link to comment
Share on other sites

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'];

 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.