/    Sign up×
Community /Pin to ProfileBookmark

Passing Variables

I can’t seem to get into the nitty gritty of this.

I’m trying to send multiple variables from page1.php to page2.php (to page3)

One var is the number(name) of an image, the 2nd is a text string that would go along with it.

On page 2, the user needs to have the option of using the assigned text, no text at all, or entering custom text which would then display on page3 with the chosen image.

I was just going to use an href statement with URL includes, but the custom variable has the opportunity of being a possibly long user entered text string.

I’m VERY new to php, & I’m really not sure how to use Sessions. From the miserably long web searching I’ve been doing, it looks like either that or cookies would be the way to go. Either way, I’m kind of over my head here.

Could someone possibly help out a newbie, please??

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Feb 16.2007 — Is "page1.php" an input form?
Copy linkTweet thisAlerts:
@ShadowwolfauthorFeb 16.2007 — page1 is a thumbnail page with text that goes with each thumb. Right now I have each thumb with an pic_id which is URL passed to page2 & displays the full sized image. But I'd like to pass the text in a variable also, which wouldn't be TOO much of a problem, (though ugly as hell in the URL). It's when I get to that user input part on page2 that it gets sticky.

I'm not asking for anyone to write code for me, so you know. Just hoping I can get pointed in the right direction to some [U]understandable[/U] beginner/intermediate breakdowns on what I could try.

?
Copy linkTweet thisAlerts:
@NightShift58Feb 16.2007 — The link will look something like this: page2.php?pci_id=123&txt=blahblah

In page2.php, you can capture these 2 variables using the $_GET array ($_GET['pic_id'] and $_GET['txt']).

You can display the text in an input variable by doing something like this:[code=php]
<input type='text' name='txt' value='<?php echo $_GET['txt']>[/code]
×

Success!

Help @Shadowwolf spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...