/    Sign up×
Community /Pin to ProfileBookmark

Accessing an input type text field in other forms

Hi,

I’m doing the following in PHP. Among some MySQL queries, I’m trying the following:

Let’s say I have a form with an input text type field with name = “User”, and a submit button. In the form that is opened when the “submit” button is clicked, I have

$A_User = $HTTP_POST_VARS[‘User’];

At this point in this second form, I can access field/variable $A_User. However, in this second form, I have another “submit” button which when clicked opens a third form. It seems that in this third form, $A_User cannot be accessed. Anyone knows how it can be done!

Much appreciated!

DL.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@HuevoosFeb 26.2006 — in the second form
[code=php]<input type="hidden" name="User" value="<?echo $HTTP_POST_VARS['User'];?>" />[/code]
is this what you were looking for???
Copy linkTweet thisAlerts:
@datalineauthorFeb 26.2006 — Hi Huevoos,

Thanks for the reply!

My question is more an HTML-type question. (May be I should have posted it there! Sorry!) It is a basic question, and I should know the answer. But I'm still learning .....

Let's say I have a form with ID = "ABC" and in this form there is an input type text field called "name". The question is "how can I access this field/element in other forms? I have checked an XHTML book I have, and tried:

variable = ABC.elements["name"];

No luck! I know this is simple and I should know it, but .....

Thanks!

DL.
Copy linkTweet thisAlerts:
@datalineauthorMar 05.2006 — Question on session variable: would anyone know why this produces the expected output (user name):

<?php

session_start();

?>

<html>

<?php

$User_Name = $_POST['User_Name'];

$_
SESSION['Temp_Name'] = $User_Name;

echo $User_Name;

?>

</html>

whereas this doesn't

<?php

session_start();

?>

<html>

<?php

$User_Name = $_POST['User_Name'];

$_
SESSION['Temp_Name'] = $User_Name;

echo $Temp_Name;

?>

</html>

I would expect the session variable $Temp_Name to be registered and available.

thx!

DL
Copy linkTweet thisAlerts:
@welshMar 05.2006 — no, i think you have to call the session variable out and store it as one so it would have to be:

<?php

session_start();

?>

<html>

<?php

$User_Name = $_POST['User_Name'];

$_
SESSION['Temp_Name'] = $User_Name;

$Temp_Name = $_SESSION['Temp_Name'];

echo $Temp_Name;

?>

</html>
Copy linkTweet thisAlerts:
@datalineauthorMar 05.2006 — Thanks Welsh! I made the change, and it works well. I am now trying to access the session variable $Temp_Name on another page, as in:

<?php

session_start();

?>

<html>

<?php

$Temp_Name = $_SESSION['Temp_Name'];

echo $Temp_Name;

?>

</html>

Any ideay why I can't access it!

Thx in advance!

DL
Copy linkTweet thisAlerts:
@datalineauthorMar 05.2006 — Anyone out there who can help me with this issue with session variable!! This should work, but for some reason isn't. I'm quite puzzled !!!!!

I have the following to create session variables, and it's working fine:

<?php

session_start();

?>

<html>

<?php

$User_Name = $_POST['User_Name'];

$_
SESSION['Temp_Name'] = $User_Name;

$Temp_Name = $_SESSION['Temp_Name'];

echo $User_Name;

echo $Temp_Name;

?>

</html>

Now, on another page, I'm trying to access the session variable created/registered above, as in:

<?php

session_start();

?>

<html>

<?php

$Temp_Name = $_SESSION['Temp_Name'];

echo $Temp_Name;

?>

</html>

The $Temp_Name variable isn't being echoed here. Anyone knows why? I'm sure it's something silly I'm doing or forgot to do !!!!!

Thank you!
×

Success!

Help @dataline 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.19,
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,
)...