How to pass and catch variable when the method is POST then the route is GET?Detecting request type in PHP (GET, POST, PUT or DELETE)How do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How to get the client IP address in PHPReference — What does this symbol mean in PHP?Codeigniter can't get a simple post data variableHow do I pass variables and data from PHP to JavaScript?How to get and count post variable (array) in CodeIgniter?image is not uploading in YII ActiveFormform not adding input data into db table
Is a paralyzed creature limp or rigid?
Are there mathematical concepts that exist in the fourth dimension, but not in the third dimension?
Why there is no wireless switch?
What is the source of the fear in the Hallow spell's extra Fear effect?
What drugs were used in England during the High Middle Ages?
Why are some hotels asking you to book through Booking.com instead of matching the price at the front desk?
Ceiling fan electrical box missing female screw holes
Is it possible to observe space debris with Binoculars?
How do I delete cookies from a specific site?
What's the difference between a share and a stock?
What quests do you need to stop at before you make an enemy of a faction for each faction?
Why did Boris Johnson call for new elections?
Bidirectional Dictionary
How were the names on the memorial stones in Avengers: Endgame chosen, out-of-universe?
How can I implement regular expressions on an embedded device?
Why are all volatile liquids combustible
Is a Wick rotation a change of coordinates?
Can anyone find an image of Henry Bolingbroke's Sovereygne Feather Seal?
How does the UK House of Commons think they can prolong the deadline of Brexit?
Dissuading my girlfriend from a scam
ASCII Maze Rendering 3000
Is it risky to move from broad geographical diversification into investing mostly in less developed markets?
Tying double knot of garbarge bag
To which airspace does the border of two adjacent airspaces belong to?
How to pass and catch variable when the method is POST then the route is GET?
Detecting request type in PHP (GET, POST, PUT or DELETE)How do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How to get the client IP address in PHPReference — What does this symbol mean in PHP?Codeigniter can't get a simple post data variableHow do I pass variables and data from PHP to JavaScript?How to get and count post variable (array) in CodeIgniter?image is not uploading in YII ActiveFormform not adding input data into db table
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm developing a web application, and I want to pass variable called ID when the form method is post
that linked to open other form but in the config/routes
I'm using $routes[page_A][get] = 'Controller'
not $routes[page_A][post] = 'Controller'
.
I'm using Codeigniter framework here, I've tried to change the controller with $this->input->get('id')
but it doesn't work and I don't have any idea whats really happen in my codes.
The Sender Form View code
<form action="<?= base_url().'progres_save'; ?>" method="POST">
<div class="form-group">
<div class="form-row">
<label for="idJobOrder">ID Job Order</label>
<input type="text" name="idJobOrder" class="form-control" value="<?php echo $rd[0]->kodejobglobal; ?>" readonly>
</div>
</div>
<div class="form-group">
<div class="form-row">
<a class="btn btn-primary col-xl-1 col-sm-1 mb-1 ml-auto mr-0 mr-md-2 my-0 my-md-3" href="job" id="back" role="button"><i class="fas fa-fw fa-arrow-left"></i> Back</a>
<button class="btn btn-primary btn-block col-xl-1 col-sm-1 mb-1 mr-0 mr-md-2 my-0 my-md-3">Save <i class="fa fa-fw fa-arrow-right"></i></button>
<input type="hidden" name="id" value="<?php echo $rd[0]->kodejobspesifik ?>">
</div>
</div>
</form>
The Sender Form Controller code
public function save()
$idglobal = $this->input->post('idJobOrder');
$data = array('jobnya' => $idglobal );
$this->Model_joborder->save_pg($data,'lapharian');
redirect('progres_material');
The Config Routes code
$route['progres_save']['get']='error';
$route['progres_save']['post']='save';
$route['progres_material']['get']='matused';
$route['progres_material']['post']='error';
The Recipient Form Controller code
public function matused()
$id = $this->input->get('id');
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
The Recipient Form View code
<form method="POST" action="<?= base_url().'matsave'; ?>">
<div class="form-group">
<div class="form-row">
<?php if (isset($rd[0])) ?>
<input type="hidden" value="<?php echo $rd[0]->jobspesifiknya; ?>" name="idClient" class="form-control" placeholder="First name" readonly>
<?php ?>
</div>
</div>
</form>
What I expect is the input id
value from Sender will be passed and catch on Recipient form as input idClient
. Can anyone her help me to find out the solution? Thank you.
php codeigniter
add a comment |
I'm developing a web application, and I want to pass variable called ID when the form method is post
that linked to open other form but in the config/routes
I'm using $routes[page_A][get] = 'Controller'
not $routes[page_A][post] = 'Controller'
.
I'm using Codeigniter framework here, I've tried to change the controller with $this->input->get('id')
but it doesn't work and I don't have any idea whats really happen in my codes.
The Sender Form View code
<form action="<?= base_url().'progres_save'; ?>" method="POST">
<div class="form-group">
<div class="form-row">
<label for="idJobOrder">ID Job Order</label>
<input type="text" name="idJobOrder" class="form-control" value="<?php echo $rd[0]->kodejobglobal; ?>" readonly>
</div>
</div>
<div class="form-group">
<div class="form-row">
<a class="btn btn-primary col-xl-1 col-sm-1 mb-1 ml-auto mr-0 mr-md-2 my-0 my-md-3" href="job" id="back" role="button"><i class="fas fa-fw fa-arrow-left"></i> Back</a>
<button class="btn btn-primary btn-block col-xl-1 col-sm-1 mb-1 mr-0 mr-md-2 my-0 my-md-3">Save <i class="fa fa-fw fa-arrow-right"></i></button>
<input type="hidden" name="id" value="<?php echo $rd[0]->kodejobspesifik ?>">
</div>
</div>
</form>
The Sender Form Controller code
public function save()
$idglobal = $this->input->post('idJobOrder');
$data = array('jobnya' => $idglobal );
$this->Model_joborder->save_pg($data,'lapharian');
redirect('progres_material');
The Config Routes code
$route['progres_save']['get']='error';
$route['progres_save']['post']='save';
$route['progres_material']['get']='matused';
$route['progres_material']['post']='error';
The Recipient Form Controller code
public function matused()
$id = $this->input->get('id');
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
The Recipient Form View code
<form method="POST" action="<?= base_url().'matsave'; ?>">
<div class="form-group">
<div class="form-row">
<?php if (isset($rd[0])) ?>
<input type="hidden" value="<?php echo $rd[0]->jobspesifiknya; ?>" name="idClient" class="form-control" placeholder="First name" readonly>
<?php ?>
</div>
</div>
</form>
What I expect is the input id
value from Sender will be passed and catch on Recipient form as input idClient
. Can anyone her help me to find out the solution? Thank you.
php codeigniter
"input id value from Sender will be passed and catch on Recipient form" Can you explain a bit more? How do you mean pass to recipient?
– Stefan Avramovic
Mar 28 at 6:55
@StefanAvramovic In Sender form, there is an input namedid
which has 1 as the value, then I want to pass that value into Recipient form.
– eleonora anggi
Mar 28 at 7:03
Like a chat or something like that?
– Stefan Avramovic
Mar 28 at 18:35
add a comment |
I'm developing a web application, and I want to pass variable called ID when the form method is post
that linked to open other form but in the config/routes
I'm using $routes[page_A][get] = 'Controller'
not $routes[page_A][post] = 'Controller'
.
I'm using Codeigniter framework here, I've tried to change the controller with $this->input->get('id')
but it doesn't work and I don't have any idea whats really happen in my codes.
The Sender Form View code
<form action="<?= base_url().'progres_save'; ?>" method="POST">
<div class="form-group">
<div class="form-row">
<label for="idJobOrder">ID Job Order</label>
<input type="text" name="idJobOrder" class="form-control" value="<?php echo $rd[0]->kodejobglobal; ?>" readonly>
</div>
</div>
<div class="form-group">
<div class="form-row">
<a class="btn btn-primary col-xl-1 col-sm-1 mb-1 ml-auto mr-0 mr-md-2 my-0 my-md-3" href="job" id="back" role="button"><i class="fas fa-fw fa-arrow-left"></i> Back</a>
<button class="btn btn-primary btn-block col-xl-1 col-sm-1 mb-1 mr-0 mr-md-2 my-0 my-md-3">Save <i class="fa fa-fw fa-arrow-right"></i></button>
<input type="hidden" name="id" value="<?php echo $rd[0]->kodejobspesifik ?>">
</div>
</div>
</form>
The Sender Form Controller code
public function save()
$idglobal = $this->input->post('idJobOrder');
$data = array('jobnya' => $idglobal );
$this->Model_joborder->save_pg($data,'lapharian');
redirect('progres_material');
The Config Routes code
$route['progres_save']['get']='error';
$route['progres_save']['post']='save';
$route['progres_material']['get']='matused';
$route['progres_material']['post']='error';
The Recipient Form Controller code
public function matused()
$id = $this->input->get('id');
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
The Recipient Form View code
<form method="POST" action="<?= base_url().'matsave'; ?>">
<div class="form-group">
<div class="form-row">
<?php if (isset($rd[0])) ?>
<input type="hidden" value="<?php echo $rd[0]->jobspesifiknya; ?>" name="idClient" class="form-control" placeholder="First name" readonly>
<?php ?>
</div>
</div>
</form>
What I expect is the input id
value from Sender will be passed and catch on Recipient form as input idClient
. Can anyone her help me to find out the solution? Thank you.
php codeigniter
I'm developing a web application, and I want to pass variable called ID when the form method is post
that linked to open other form but in the config/routes
I'm using $routes[page_A][get] = 'Controller'
not $routes[page_A][post] = 'Controller'
.
I'm using Codeigniter framework here, I've tried to change the controller with $this->input->get('id')
but it doesn't work and I don't have any idea whats really happen in my codes.
The Sender Form View code
<form action="<?= base_url().'progres_save'; ?>" method="POST">
<div class="form-group">
<div class="form-row">
<label for="idJobOrder">ID Job Order</label>
<input type="text" name="idJobOrder" class="form-control" value="<?php echo $rd[0]->kodejobglobal; ?>" readonly>
</div>
</div>
<div class="form-group">
<div class="form-row">
<a class="btn btn-primary col-xl-1 col-sm-1 mb-1 ml-auto mr-0 mr-md-2 my-0 my-md-3" href="job" id="back" role="button"><i class="fas fa-fw fa-arrow-left"></i> Back</a>
<button class="btn btn-primary btn-block col-xl-1 col-sm-1 mb-1 mr-0 mr-md-2 my-0 my-md-3">Save <i class="fa fa-fw fa-arrow-right"></i></button>
<input type="hidden" name="id" value="<?php echo $rd[0]->kodejobspesifik ?>">
</div>
</div>
</form>
The Sender Form Controller code
public function save()
$idglobal = $this->input->post('idJobOrder');
$data = array('jobnya' => $idglobal );
$this->Model_joborder->save_pg($data,'lapharian');
redirect('progres_material');
The Config Routes code
$route['progres_save']['get']='error';
$route['progres_save']['post']='save';
$route['progres_material']['get']='matused';
$route['progres_material']['post']='error';
The Recipient Form Controller code
public function matused()
$id = $this->input->get('id');
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
The Recipient Form View code
<form method="POST" action="<?= base_url().'matsave'; ?>">
<div class="form-group">
<div class="form-row">
<?php if (isset($rd[0])) ?>
<input type="hidden" value="<?php echo $rd[0]->jobspesifiknya; ?>" name="idClient" class="form-control" placeholder="First name" readonly>
<?php ?>
</div>
</div>
</form>
What I expect is the input id
value from Sender will be passed and catch on Recipient form as input idClient
. Can anyone her help me to find out the solution? Thank you.
php codeigniter
php codeigniter
edited Mar 28 at 6:46
eleonora anggi
asked Mar 28 at 4:09
eleonora anggieleonora anggi
357 bronze badges
357 bronze badges
"input id value from Sender will be passed and catch on Recipient form" Can you explain a bit more? How do you mean pass to recipient?
– Stefan Avramovic
Mar 28 at 6:55
@StefanAvramovic In Sender form, there is an input namedid
which has 1 as the value, then I want to pass that value into Recipient form.
– eleonora anggi
Mar 28 at 7:03
Like a chat or something like that?
– Stefan Avramovic
Mar 28 at 18:35
add a comment |
"input id value from Sender will be passed and catch on Recipient form" Can you explain a bit more? How do you mean pass to recipient?
– Stefan Avramovic
Mar 28 at 6:55
@StefanAvramovic In Sender form, there is an input namedid
which has 1 as the value, then I want to pass that value into Recipient form.
– eleonora anggi
Mar 28 at 7:03
Like a chat or something like that?
– Stefan Avramovic
Mar 28 at 18:35
"input id value from Sender will be passed and catch on Recipient form" Can you explain a bit more? How do you mean pass to recipient?
– Stefan Avramovic
Mar 28 at 6:55
"input id value from Sender will be passed and catch on Recipient form" Can you explain a bit more? How do you mean pass to recipient?
– Stefan Avramovic
Mar 28 at 6:55
@StefanAvramovic In Sender form, there is an input named
id
which has 1 as the value, then I want to pass that value into Recipient form.– eleonora anggi
Mar 28 at 7:03
@StefanAvramovic In Sender form, there is an input named
id
which has 1 as the value, then I want to pass that value into Recipient form.– eleonora anggi
Mar 28 at 7:03
Like a chat or something like that?
– Stefan Avramovic
Mar 28 at 18:35
Like a chat or something like that?
– Stefan Avramovic
Mar 28 at 18:35
add a comment |
2 Answers
2
active
oldest
votes
You can use PHP global variable $_REQUEST
to capture the data if you are not sure about the request type like this,
public function matused()
$id = $_REQUEST['id'];
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
add a comment |
You forgot to include the id
data on the redirect after the save()
method is called, so you will not get anything by calling $this->input->get('id')
.
To solve this, pass the id
data along with the redirect :
redirect('progres_material?id=' . $this->input->post('id'));
But that of course it will gives you an extra parameter on the url. If you don't want additional parameter, you could alternatively use session to pass id
data while redirecting, on CodeIgniter there is a method called set_flashdata
to do this :
$this->session->set_flashdata('id', $this->input->post('id'));
redirect('progres_material');
And to get the id
session data on the matused()
method, use the following code :
$id = !empty($this->session->flashdata('id')) ? $this->session->flashdata('id') : $this->input->get('id');
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390022%2fhow-to-pass-and-catch-variable-when-the-method-is-post-then-the-route-is-get%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use PHP global variable $_REQUEST
to capture the data if you are not sure about the request type like this,
public function matused()
$id = $_REQUEST['id'];
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
add a comment |
You can use PHP global variable $_REQUEST
to capture the data if you are not sure about the request type like this,
public function matused()
$id = $_REQUEST['id'];
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
add a comment |
You can use PHP global variable $_REQUEST
to capture the data if you are not sure about the request type like this,
public function matused()
$id = $_REQUEST['id'];
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
You can use PHP global variable $_REQUEST
to capture the data if you are not sure about the request type like this,
public function matused()
$id = $_REQUEST['id'];
$data['rd'] = $this->Model_joborder->tampil2($id);
$data['fb'] = $this->Model_joborder->data_cbb();
$this->load->view('matused', $data);
answered Mar 28 at 4:39
RopAli MunshiRopAli Munshi
8912 gold badges7 silver badges23 bronze badges
8912 gold badges7 silver badges23 bronze badges
add a comment |
add a comment |
You forgot to include the id
data on the redirect after the save()
method is called, so you will not get anything by calling $this->input->get('id')
.
To solve this, pass the id
data along with the redirect :
redirect('progres_material?id=' . $this->input->post('id'));
But that of course it will gives you an extra parameter on the url. If you don't want additional parameter, you could alternatively use session to pass id
data while redirecting, on CodeIgniter there is a method called set_flashdata
to do this :
$this->session->set_flashdata('id', $this->input->post('id'));
redirect('progres_material');
And to get the id
session data on the matused()
method, use the following code :
$id = !empty($this->session->flashdata('id')) ? $this->session->flashdata('id') : $this->input->get('id');
add a comment |
You forgot to include the id
data on the redirect after the save()
method is called, so you will not get anything by calling $this->input->get('id')
.
To solve this, pass the id
data along with the redirect :
redirect('progres_material?id=' . $this->input->post('id'));
But that of course it will gives you an extra parameter on the url. If you don't want additional parameter, you could alternatively use session to pass id
data while redirecting, on CodeIgniter there is a method called set_flashdata
to do this :
$this->session->set_flashdata('id', $this->input->post('id'));
redirect('progres_material');
And to get the id
session data on the matused()
method, use the following code :
$id = !empty($this->session->flashdata('id')) ? $this->session->flashdata('id') : $this->input->get('id');
add a comment |
You forgot to include the id
data on the redirect after the save()
method is called, so you will not get anything by calling $this->input->get('id')
.
To solve this, pass the id
data along with the redirect :
redirect('progres_material?id=' . $this->input->post('id'));
But that of course it will gives you an extra parameter on the url. If you don't want additional parameter, you could alternatively use session to pass id
data while redirecting, on CodeIgniter there is a method called set_flashdata
to do this :
$this->session->set_flashdata('id', $this->input->post('id'));
redirect('progres_material');
And to get the id
session data on the matused()
method, use the following code :
$id = !empty($this->session->flashdata('id')) ? $this->session->flashdata('id') : $this->input->get('id');
You forgot to include the id
data on the redirect after the save()
method is called, so you will not get anything by calling $this->input->get('id')
.
To solve this, pass the id
data along with the redirect :
redirect('progres_material?id=' . $this->input->post('id'));
But that of course it will gives you an extra parameter on the url. If you don't want additional parameter, you could alternatively use session to pass id
data while redirecting, on CodeIgniter there is a method called set_flashdata
to do this :
$this->session->set_flashdata('id', $this->input->post('id'));
redirect('progres_material');
And to get the id
session data on the matused()
method, use the following code :
$id = !empty($this->session->flashdata('id')) ? $this->session->flashdata('id') : $this->input->get('id');
answered Apr 9 at 7:56
Hasta DhanaHasta Dhana
3,4202 gold badges12 silver badges22 bronze badges
3,4202 gold badges12 silver badges22 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390022%2fhow-to-pass-and-catch-variable-when-the-method-is-post-then-the-route-is-get%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"input id value from Sender will be passed and catch on Recipient form" Can you explain a bit more? How do you mean pass to recipient?
– Stefan Avramovic
Mar 28 at 6:55
@StefanAvramovic In Sender form, there is an input named
id
which has 1 as the value, then I want to pass that value into Recipient form.– eleonora anggi
Mar 28 at 7:03
Like a chat or something like that?
– Stefan Avramovic
Mar 28 at 18:35