Mixing html, php and asp

request comes from a get method

In html I can code:

<%=request("variable")%> and it works ok.

Is there an equivalent to insert a get variable with php?
robrodpAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WebDevEMCommented:
I think this is what you're looking for:
<?php echo $_GET['variable'] ?>

Open in new window

to display the value from mypage.php?variable=123.  It would need to be on a .php page though, so I'm not sure if you plan to mix php and asp on the same page somehow.
0
robrodpAuthor Commented:
I set my code to this line:


"http://ciiam.com/alta/index.asp?ejec=<?php echo $_GET['variable'] ?>"

I need it to be:

http://ciiam.com/alta/index.asp?ejec=variable"
0
WebDevEMCommented:
What kind of page is this code on?  (asp or php?) Can you post more of the code so I can see what you're doing better?  

If this is on a mypage.php page, and you're trying to link to that URL, you might do something like this:
<a href="http://ciiam.com/alta/index.asp<?php echo $_GET['variable']; ?>">Alta</a>

Open in new window

If you could post more of the code, that would help.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

robrodpAuthor Commented:
It is html code:

Origial code is:

It is on a php platform and the variable comes from and html page

<iframe name="Alta Simplificada"  frameborder="0"  width="1000" height="1200" src="http://ciiam.com/alta/index.asp"></iframe>

I need to pass the variable (ejec)  to the asp page:

<iframe name="Alta Simplificada"  frameborder="0"  width="1000" height="1200" src="http://site.com/alta/index.asp?ejec=<?php echo $_GET['variable'] ?>"></iframe>
0
WebDevEMCommented:
Ok, thanks... I've created test pages (on an internal server, so I can't send a URL) and have it working here.
 
test.php
<iframe name="Alta Simplificada"  frameborder="0"  width="1000" height="1200" src="http://site.com/alta/index.asp?ejec=<?php echo $_GET['variable']; ?>"></iframe>

Open in new window

form.html
<form method="get" action="test.php">
<input type="text" name="variable" />
<button type="Submit">Submit</button>
</form>

Open in new window

If you fill in the input box and press submit, it sends variable to test.php and adds it to the end of the iframe's URL.  The key pieces that need to be paid attention to are that the NAME of the INPUT field (or SELECT, or whatever you use) needs to be the same as inside the quotes inside the $_GET['variable']  Also, my first example was missing a semicolon before the ?> so that may have caused an error.

With that code, if you enter a "3" in the box and hit SUBMIT, the php page will create
<iframe name="Alta Simplificada"  frameborder="0"  width="1000" height="1200" src="http://site.com/alta/index.asp?ejec=3"></iframe>

Open in new window

0
robrodpAuthor Commented:
Can you do it with a post?
0
WebDevEMCommented:
Sure can - If you change the form to method="post" you just need to change the PHP code to $_POST['variable'].  There's an article at http://www.w3schools.com/php/php_forms.asp which explains it nicely and lets you experiment with it.
0
robrodpAuthor Commented:
can I send it with and index.html?ejec=3
0
robrodpAuthor Commented:
Sorry... I am confused will be back later Thx
0
robrodpAuthor Commented:
Ok...

I type this:

http://site1.com.mx/contactosoc/altas.html?ejec=123


<iframe name="Alta Simplificada"  frameborder="0"  width="1000" height="1200" src="http://site2.com/alta/index.asp?ejec=<?php echo $_GET['ejec']; ?>"></iframe>
0
WebDevEMCommented:
My turn to be confused.... is atlas.html where your form is, like in the example at w3schools, or are you trying to have atlas.html take the parameter and pass it along to the iframe?  That may be where the confusion is.  If you want the <?php echo $_GET['ejec']; ?> to work, the page needs to have a .php extension.  Just being on a php server isn't enough to have an html page use php intelligence.  if that's what you're trying to do, rename atlas.html to atlas.php and it will interpret the php code instead of just displaying it on the page.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
robrodpAuthor Commented:
Any more ideas? What am I doing wrong?
0
robrodpAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 500 points for WebDevEM's comment #a39464819
Assisted answer: 0 points for robrodp's comment #a39464212

for the following reason:

As usual.. I do so many things I get confused and confuse experts. Thx for your help
0
RobOwner (Aidellio)Commented:
That's not a solution so can you please clarify why you would accept the comment above as one?

You can use javascript to get the variables in the querystring:

<html>
<head>
<script>
function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));

}
window.onload = function() {
	document.getElementById('myiframe').src = "http://site2.com/alta/index.asp?ejec=" + getParameterByName('ejec');
}
</script>
</head>
<body>
<iframe id="myiframe" name="Alta Simplificada"  frameborder="0"  width="1000" height="1200" src=""></iframe>

</body>
</html>

Open in new window

0
WebDevEMCommented:
Tagit,

While yours is a valid solution using javascript, I believe I posted a valid solution using PHP as asked in the original post.  Which solution he ends up using ultimately relies on what direction he decides to take with his code (server-side php or client-side javascript) and which he is more comfortable implementing.  

No matter which way he goes with it, the goal is that he gets the job done that he came to solve.  I'm not fighting for points here, but to say my answer isn't a solution seems a bit strong.  It's a different solution than you would have used.

WebDevEM
0
robrodpAuthor Commented:
Hi...

Guys WebDevEM solution certainly works so it is a solution and I accepted as such.

I was trying to mix asp and asp codes and it did just that.

I am sure your javascript solution will work but it was posted after closed the question.

Otherwise I would have tested and considered your solution.
0
robrodpAuthor Commented:
I agree. But if WebDevEM posted a solution it worked and I accepted it,  I don't understand how another expert (tagit in this case) follows up (a closed question) says my accepted solution does not work (which does), post a different solution and gves another solution.

Am I mistaken here? Or should I consider addiitonal solutions once the question is closed as accepted?
0
robrodpAuthor Commented:
What does this mean? On Sep 04 I accepted the solution

I've requested that this question be closed as follows:

Accepted answer: 500 points for WebDevEM's comment #a39464819
Assisted answer: 0 points for robrodp's comment #a39464212

for the following reason:

As usual.. I do so many things I get confused and confuse experts. Thx for your help
0
robrodpAuthor Commented:
So it is not enough to accept an answer and assign ponts to close it? Just to make sure
0
robrodpAuthor Commented:
Ok.. Thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.