0

i have gallery.php?gid=1 in gallery.php page and i have to submit data to save.php without using a form.

and i want to get the value of gid without using a button..

is that possible?

gallery.php

$gid=$_GET['gid'];

save.php

echo $gid..

4
  • 2
    What have you tried? Explain what your code is doing, and where you are actually confused. Commented Jan 17, 2013 at 13:06
  • 1
    Using get in a form simply redirects the web page to the address, which in your case would look like gallery.php?gid=WhateverInfoYouWantToPutHere. Simple answer, make a link. Commented Jan 17, 2013 at 13:07
  • 1
    if you call the script like gallery.php?gid=1 than you can access the value with $_GET['gid']. Commented Jan 17, 2013 at 13:08
  • i am using adobe flash php multi uploader. i have two tables like gallery and album and those two were related by having the album_id in gallery_id. but i cant save the album_id of that gallery because of $_GET. Commented Jan 17, 2013 at 13:09

3 Answers 3

1
header("location:save.php?gid=".$gid);

OR

use a anchor tag with href="save.php?gid=<?php echo $gid;?>"

Sign up to request clarification or add additional context in comments.

3 Comments

actually, an anchor would be href="save.php#anchor"
You can make it like href="save.php?gid=<?php echo $gid;?>#anchor"
I know that, I just wanted to point out that #anchor != Query String.
1

$_GET will contain all the variables which are in the URL, after the "?" (foo.php?gid=...).

You are not obliged to use a form to fill these variables.

Comments

0

The members of $_GET array is got from query string. In a simple way, a query string is tha part after the ? character of the URL and formatted in this way:

param1=value1&param2=value2&....

So you can pass any pair of key-value in to your PHP script by adding a query string to the end of this PHP file URL.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.