Forum Moderators: coopster
I need some help in paasing varables back to the actaul web page that called the server side php script in the first place?
Want i am trying to do is pass back to the web page that called my server sode script - i want to pass back values and these values need to set the propertys in the current web page that uses HTML and is a iframe construct?
<iframe id="ifrm" name="ifrm" src="$index" scrolling="no"
width="400" height="100" frameborder="0">
</iframe>
In the HTML construct above i want to set the src propery to a the value contained in the server side php script.
how can i do this and what is the best metord to do this type of thing.
note: I need to pass more then one proerty is there a esay way to do this?
The other property i want to set is either make a hidden DIv visable or a layer tag change it from hide to show example follows:
<layer name="foo" visability=hide>
<iframe id="ifrm" name="ifrm" src="$index" = scrolling="no"
width="400" height="100" frameborder="0">
</iframe>
</layer>
last but least should i use a hidden DIV or a layer what are the pros and cons and - I have heard it refered to as a hidden DIV but how is it done please give me a example.
THANKS
Frank H. Shaw
To return variables from a script you could simply url encode them in a 'header Location' string pointing at your original page. ie -
header("Location: youroriginalpage.php?Variable1=Value1&Variable2=Value2&Variable3=Value3");
this would send three variables via the $_GET method to 'youroriginalpage.php1 the variables would be -
$Variable1 = Value1
$Variable2 = Value2
$Variable3 = Value3
and you would capture them in 'youroriginalpage.php' like this -
$Variable1 = $_GET['Variable1'];
$Variable2 = $_GET['Variable2'];
$Variable3 = $_GET['Variable3'];
Bear in mind you should only use the $_GET method for non sensitive info, as it is visible in the URL. If you would like to hide the variables, use $_POST method (this would require using a different method than shown above)
//Variable that controls which CSS rule to use
//Send either display=yes or display=no to this page
//If yes display, if no hide
$display = $_GET['display'];
if ($display == "no"){
$visibility = 'display:none;';
}
css -
<div style="<?PHP print $visibility;?>" />
</div>
in your form where the user selects the option that controls visibility, you would set the action as $_SERVER['PHP_SELF']; and the form method as 'POST' this will send the value of the form to itself (and refresh the page) via the hidden 'POST' method.
If you just want to control the visibility of a div you could also do a similar thing with Javascript which would mean that the page would not need to be reloaded. - but you may require other variable handling / script that could rule this option out.
THANKS
Frank H. Shaw
THANKS
Frank H. Shaw