I'm stuck

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Cryptkeeper
Forum Newbie
Posts: 17
Joined: Wed Nov 10, 2004 3:05 am

I'm stuck

Post by Cryptkeeper »

Hi.

I've got a problem and I just can't seem to solve it. Let me explain.
I've got 3 files:
var1.php, flash.php and test7.swf

var1.php

Code: Select all

<?php
<?
$test = 0;
for ($i = 0; $i<5; $i++)
{
$test++;
print "<FONT FACE="verdana" SIZE=2><a href=flash.php?number=$test target="_blank">link</a></FONT>";
print "<BR>";
}
?>
?>
flash.php

Code: Select all

<?php
<?php
$nr = $_REQUEST['number']; 
if ($nr == 1)
{
$grondkaart='test.jpg';
}
echo "&pic=http://***/phpserver/****/$grondkaart";
?>
?>
The code echo "&pic..." sends the variable pic to my flash file. The flash file is a file that let's you zoom and rotate a picture.
There's a code in my flash file that gets the variable out of flash.php.

If I put this line in flash.php at the bottom

Code: Select all

header("Location: test7.swf");
it doesn't work. The flash file doesn't show any image. I think the header statement doesn't work that well with flash.
I've allready tested the flash file and he does get the variable out of flash.php. The flash file works perfectly, so that's not the problem.

I can't use sessions, because when I do the session variable is allways the last number from the for loop (in this case '5');

So what I want to do is simple.
Go to the var1.php. Press link, the var pic in flash.php is then filled with the right jpeg, according to what link you pressed (1,2,3,4 or 5). I've only tested on 1 here in this example. (so far this all works) and then the file test7.swi has to be called without the header statement.
And that's where I'm stuck.

Can you help me?
I hope you understand the problem, ask questions if you don't.

*EDIT*
If I put

Code: Select all

header("Location: test7.swf");
in var1.php it works.
Then ofcourse I have to change my code in flash.php to this

Code: Select all

echo "&amp;pic=http://***/phpserver/****/test.jpg";
I just can't seem to use the header statament in flash.php
Cryptkeeper
Forum Newbie
Posts: 17
Joined: Wed Nov 10, 2004 3:05 am

Post by Cryptkeeper »

Okay, this might all be to complicated so I will put it very simple.
Forget what I posted above.

I need to press this link

Code: Select all

print "<FONT FACE="verdana" SIZE=2><a href=flash.php?number=$test target="_blank">link</a></FONT>";
When I do, I want a variable to be sent to flash.php and then automaticly redirect to another link, all with one press on the link.
Is this possible?
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

How to

Post by neophyte »

I'd say yes. When they press that link you could change directions on the next page after some php processing using:

Code: Select all

<?php
  header("Location:http://somesite.com/somepage.php?".$_SERVER['REQUEST_URI']);
?>
$_SERVER['REQUEST_URI'] you don't need this variable at the end if your not going to use it in the flash movie.

And then in flash just set up a dynamic text box with the same name as your query string variable and set it to the GET method. That oughta do it.
Cryptkeeper
Forum Newbie
Posts: 17
Joined: Wed Nov 10, 2004 3:05 am

Post by Cryptkeeper »

Hmmm, I don't quite follow you neophyte.
Do I need to put the .$_SERVER['REQUEST_URI'] in the header call in flash.php?

Does the dynamic textbox in flash has to have the same name (.$_SERVER['REQUEST_URI'])?

Thanks anyway to try to help me!
Cryptkeeper
Forum Newbie
Posts: 17
Joined: Wed Nov 10, 2004 3:05 am

Post by Cryptkeeper »

Okay, I have a very strange problem.

Running flash.php with this

Code: Select all

<?php

$grondkaart="gelijkvloers002.jpg";
echo "&pic=http://****/kaarten/$grondkaart";

?>
and this

Code: Select all

<?php
$nr = $_REQUEST['number']; //variable passed through link

if ($nr == 1)
{
$grondkaart="gelijkvloers002.jpg";
}
?>

<?php
echo "&pic=http://*****/kaarten/$grondkaart";


?>
returns: http://*****/kaarten/gelijkvloers002.jpg


Running flash.php with this

Code: Select all

<?php
$grondkaart="gelijkvloers002.jpg";
?>

<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development
window.location="http://****/test/test7.swf";
// -->
</script>
</head>
</html>

<?php
echo "&pic=http://*****/kaarten/$grondkaart";

?>
And my flash movie works perfectly.

Running flash.php with this

Code: Select all

<?php
$nr = $_REQUEST['number']; //variable passed through link

if ($nr == 1)
{
$grondkaart="gelijkvloers002.jpg";
}
?>

<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development
window.location="http://****/test/test7.swf";
// -->
</script>
</head>
</html>

<?php
echo "&pic=http://*****/kaarten/$grondkaart";
?>
And my flash movie doesn't work. I print the var 'pic' in my flash movie and it shows:
http://*****/kaarten/


Do you guys understand this??? :?:
Post Reply