How to POST variables between PHP scripts

Hi,

I would like to display a list of names in a script (A.PHP3). Whent the user clicks on any
of these names I would like to call script B.PHP3, passing it the name that was clicked as
a variable.

Is there a way of doing this without using a form?

I would like to list of name to appear as text (like links) instead of submit buttons.

Thanks.

Gerhard
LVL 1
Gerhard100198Asked:
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.

freshmeatCommented:
can u post your code here?

if i understand u correctly, u mean u wanna use a method like ASP's "querystring", right?

u can try : <a href=b.php3?variable1=...&variable2=...>NAME1<a>

hope it can help u
0
oubelkasCommented:
You can call a php page and along with it pass a name.

<a href="mypage.php3?name='carl'">

then with this value you can do the things you want in mypage.php3 like :

 <input type="hidden" name="myname" value="<?echo $name; ?>">
    <? if ($name == "Carl") {
          echo "Yes, it is him!!";
        } else {
          echo "Mmmm, nope..it is Pete.";
        };
    ?>


Joseph
0
oubelkasCommented:
Sorry, freshmeat, didn't see your code yet....
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

oubelkasCommented:
Whoops

<? if ($name == "Carl") {

must be, in this case

<? if ($myname == "Carl") {

0
freshmeatCommented:
oubelkas, your comment is more detailed than mine
:)
0
Gerhard100198Author Commented:
Thanks guys, I've got it sorted out. Freshmeat, I think the points are yours, you were first with code that works.

Just out of interest though... Using the above method is like using a form with a GET. Is there a way to simulate a POST?
0
oubelkasCommented:
No thanks Gerhard, you can accept freshmeat's comment as an answer. Don't forget the O'Reilly Q, ok?

Freshmeat,

Yep, mine was more detailed, but yours was right too according to Gerhard, so the points are yours ;)

Joseph
0
freshmeatCommented:
sorry, i am not sure i can do it
maybe u can have a try about :
<script language=javascript>
function func1()
{
document.form1.submit()
}
</script>

<form name=form1 action="b.php3>
<input type=hidden name=variable1 value=...>
<input type=hidden name=variable2 value=...>
<a href="javascript:func1()">NAME</a>
</form>

hope i can get the points successfully!
:)
0
Gerhard100198Author Commented:
Freshmeat, submit yout original comment as an answer and the points are your.

Thanks.
0
freshmeatCommented:
if i understand u correctly, u mean u wanna use a method like ASP's "querystring", right?

u can try :
1,
<a href=b.php3?variable1=...&variable2=...>NAME1<a>

2,
<script language=javascript>
function func1()
{
document.form1.submit()
}
</script>

<form name=form1 action="b.php3>
<input type=hidden name=variable1 value=...>
<input type=hidden name=variable2 value=...>
<a href="javascript:func1()">NAME</a>
</form>


hope it can help u
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
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.