/    Sign up×
Community /Pin to ProfileBookmark

is it possible to pass a value while re-direct?

Hi all:

I want to re-direct users to a different page after he/she successully submit a form. However, I also want to print a record id number.

Can you help me?

Thanks,

SS

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@pcthugAug 04.2006 — I'm not sure if this is the solution you were looking for because you didn't fully explain yourself; why not just pass the record id number in the url?
<i>
</i>http://redirection/page?record_id=100
Copy linkTweet thisAlerts:
@cridleyAug 04.2006 — or, if it's from a submit button on a form, have a hidden input in the form

<input type='hidden' name='record_id' value='100'>
Copy linkTweet thisAlerts:
@smallstoneauthorAug 04.2006 — Hi all:

Thanks for replies.

Here is the situation.

From Inputform.php users click on submit button that goes to results.php. However, I don't want users see the results.php page. Therefore; I re-direct him to message.php page.

I am able to print hisname and a record number on results.php page, but I don't know how to print them on message.php page.

Thanks again.

SS
Copy linkTweet thisAlerts:
@cridleyAug 04.2006 — in results.php

[code=php]header("Location:message.php?record_id=$ID")[/code]

where $ID is something like $_GET['record_id']

in message.php you can then access $_GET['record_id']
Copy linkTweet thisAlerts:
@smallstoneauthorAug 04.2006 — cridley:

I am not sure how to make it works.

SS
Copy linkTweet thisAlerts:
@cridleyAug 04.2006 — Ok...

Inputform.php :
[code=html]<form method="post" action="results.php">
Type in a record ID : <input type="text" name="record_id" />
<input type="submit">
</form>[/code]

results.php:

[code=php]<?php
//do whatever it is this page does....

$ID = $_POST['record_ID'];
header("Location:message.php?record_id=$ID");
?>
[/code]

message.php :

[code=php]<?php
echo "Done something whith record $_GET['record_ID']";
?>[/code]
Copy linkTweet thisAlerts:
@smallstoneauthorAug 07.2006 — cridley:

Thanks. I use Get instead of Post. I haven't tried your code yet. Anyway thank you so much for your help.

SS
Copy linkTweet thisAlerts:
@NogDogAug 07.2006 — You could use sessions and the $_SESSION array.
×

Success!

Help @smallstone 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...