Jump to content

passing variables values using POST


sudhakararaog

Recommended Posts

 

i am presently passing the value of a variable to a php file using GET after data has been inserted to the database.

 

ex=

 

$firstname = $_POST["firstname"];

 

if(!$sqlconnection)

{

echo "error message";

}

else

{

header("Location: thankyou.php?firstnameis=$firstname");

}

 

how can i send the value of $firstname using POST instead of GET as the value is presently appearing in the address bar. ideally i would like using POST.

 

NOTE = please suggest techniques that does NOT involve javascript in order to pass $firstname using POST method, as i have done the entire validations using php and i have assumed that user has javascript turned off.

 

please advice.

 

thanks.

 

Link to comment
Share on other sites

To pass it via post you need to have a form. Then you can set it up as a hidden input.

 

If your not dealing with a form, you could just set a session with the information in it...

 

<?php
session_start(); //remember to call this for every page you want the session on

$_SESSION['firstname'] = $firstname;

Link to comment
Share on other sites

  • 3 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.