Yes In know this has been covered in other ways, but after searching the forum I did not find a specific solution that fit my application. Maybe I overlooked something, so I'm sory if I did.
Here's what I have got. It's very simple (or at least should be). I have a page on my site that has a URL of: http://mysite.come/page.php?gid=1
And in that page I have an iframe that calls for the gid variable like this: -
<iframe src="family.iframe.php?gid=<?php echo $gid; ?>"
-
family.iframe.php is another page I have that has formatting and other stuff on it. I basically gets called over and over again until there is nothing left to display. This is not the problem though. I have this setup working in a different fashion elsewhere. Plus I can go directly to mysite.com/family.iframe.php?gid=1 and get the results I want on a full page. But I want it to go in that iframe I have created. Am I missing a bit of code that pulls the 'gid=1' from the url and inserts it into the 'echo' section? I have tried using the $var=$_GET method with no luck as well. Any ideas?
8 3433 pbmods 5,821
Recognized Expert Expert
Heya, docebrown. Welcome to TSDN!
Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
The correct syntax is: -
<iframe src="family.iframe.php?gid=<?php echo $_GET['gid']; ?>"
-
Sorry about that. Thanks for the correction. Does anyone have any idea as to why I can not grab the 'gid' variable?
pbmods 5,821
Recognized Expert Expert
Heya, docebrown.
This usually has to do with whether the register_globals directive is turned on in your php.ini file.
As a general rule, it is considered a good idea to not only know beforehand what the variables should be named, but also where they are coming from. For example, these three variables are distinct: -
$var1 = $_GET['gid']; // Passed in URL
-
$var2 = $_POST['gid']; // Generally passed as part of submitted form data
-
$var3 = $_COOKIE['gid']; // Stored in a cookie
-
If you are expecting your variable to be passed in the URL (i.e., $_GET), then you're probably not too concerned about security.
On the other hand, if you are doing sensitive stuff, such as changing User account information, you'll want to make sure that these values are passed via post so as to discourage XSS. In this case, it becomes important to be able to explicitly use $_POST['var'].
If you want register_globals-like behavior in your scripts, consider adding this line at the top:
Thanks for the help on this. I checked and that setting IS turned OFF and my admin won't change it. So I used your remedy and instead of just using the:
I used - <?PHP echo $_GET['gid']; ?>
and it works like a charm. Thanks for the explanation on the different ways to pass and pull vairables. I am not all that familiar with PHP and HTML, but I know enough to get myself into trouble. That explanation will help me in another area I am working on! Thanks again!
pbmods 5,821
Recognized Expert Expert
Heya, docebrown.
Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Hi guys,
I'm a bit of a PHP noob so patience is required :). I'm probably doing something basic incorrectly but I would like to use the variable called src1 in a url I either echo or use printf. its currently showing the iframe but no url for it.
You see I am taking variables from MySql and using them to change the url based on user input. I want to be able to take the php variable thats got the values from the database and then place this new url in the iframe.
Any Input would be greatly appreciated. Thanks - $src1 = 'somewhere;
-
$myVar = $_GET['src1'];
-
-
printf ('<html>
-
-
<iframe id="I1" name="I1" style="width: 892px; height: 450px" src=="http://www.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=<?PHP echo $_GET['src1']; ?> ">
Markus 6,050
Recognized Expert Expert @kierandes
That ain't too hard, friend. You've pretty much got it done, just not quite ;)
Doing <?php ... ?> inside a string will do sod all. Instead, you need to close the string, then call your variable, and then reopen your string.
Check out the following: -
$name = "mark";
-
-
echo "My name is ", $name, ". Nice to meet you.";
-
// Or (notice the difference in concatenation)
-
echo "My name is " . $name . ". Nice to meet you.
-
// The first option is faster.
-
Try and use this in your code.
@Markus
Thanks Mate,
THis is my attempt at what your suggesting. Its not quite right yet (my attempt). - echo "<iframe SRC=\"" . "http://www.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=" . $lat_mins . "width="100%" height=\"100%\" frameborder=\"0\">If you can read this your browser does not support iframes.</iframe>";
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Consuelo Guenther |
last post by:
Hello,
I am having problems with passing variables between pages. I have the
following:
First asp page has the function:
-----------------------------------------------------------------------...
|
by: Doruk |
last post by:
The problem that we are experiencing is simple:
We want to pass certain parameters from a page with several server
controls to another page.
We want to do this in a dotnet compliant manner,...
|
by: Eric |
last post by:
Hello,
I am trying to come up with the best way to pass large amounts of data from
page to page, namely a data table.
The user needs to enter data into a form in one page and confirm it on...
|
by: Roy |
last post by:
Hey all,
Is it possible to pass session variables between pages in separate
projects?
For example:
inetpub\thisproject\blah.aspx
has a session variable and response.redirects the user to...
|
by: Khai |
last post by:
First off, yes, I understand the crapload of tutorials out there, (well,
rather, I understand there /are/ a crapload of tutorials out there), the
problem is my comprehension.
I'm trying to pass...
| |
by: Skeets |
last post by:
i'm passing session and hidden variables between pages. not to mention
post values.
i'm a little concerned that someone with sufficient knowledge could
spoof these vlaues and manipulate the...
|
by: Carly |
last post by:
Hi,
I work in Visual Basic .NET 2002 using ASP.NET.
I am wondering what would be the best way to store/pass variables
between pages.
(Sessions are sooo simple to use but I hear they are not the...
|
by: Smokey Grindle |
last post by:
For a website that has users logged into it using sessions, its it best to
pass data between pages in session variables or through query strings?
|
by: K. A. |
last post by:
I have two servers at work, 'A' for testing and development, and
server 'B' for production.
On server A, I wrote a PHP test code to login users then direct them
to a personalized page. This is...
|
by: coool |
last post by:
Hi :)
anyone knows how can I send variables from a php page to a form - i need to fill the form with these variables ?
maybe using (the process of passing variables to other pages - through...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |