how to call another php file with parameters?
i want to export two different type of xlsx file
based on radio button .
$sel = $_POST['sel'];
echo $sel;
if(isset($_POST['search'])){
if($sel == 'board')
{
header('Location: export_data1.php?
num='.$_POST['staff']);
die();
}
else
{
header('Location: export_data2.php?
num='.$_POST['desg']);
die();
}
}
how to call another php file based on my radio button.Is there any other alternate way to call php file with passing arguments?
php
|
show 2 more comments
i want to export two different type of xlsx file
based on radio button .
$sel = $_POST['sel'];
echo $sel;
if(isset($_POST['search'])){
if($sel == 'board')
{
header('Location: export_data1.php?
num='.$_POST['staff']);
die();
}
else
{
header('Location: export_data2.php?
num='.$_POST['desg']);
die();
}
}
how to call another php file based on my radio button.Is there any other alternate way to call php file with passing arguments?
php
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 '18 at 6:47
i try that method not working in my form
– antony
Nov 20 '18 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 '18 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 '18 at 8:07
An aside: you might want to url encode your query string. Seeurl_encode
and/orhttp_build_query
.
– Progrock
Nov 20 '18 at 8:10
|
show 2 more comments
i want to export two different type of xlsx file
based on radio button .
$sel = $_POST['sel'];
echo $sel;
if(isset($_POST['search'])){
if($sel == 'board')
{
header('Location: export_data1.php?
num='.$_POST['staff']);
die();
}
else
{
header('Location: export_data2.php?
num='.$_POST['desg']);
die();
}
}
how to call another php file based on my radio button.Is there any other alternate way to call php file with passing arguments?
php
i want to export two different type of xlsx file
based on radio button .
$sel = $_POST['sel'];
echo $sel;
if(isset($_POST['search'])){
if($sel == 'board')
{
header('Location: export_data1.php?
num='.$_POST['staff']);
die();
}
else
{
header('Location: export_data2.php?
num='.$_POST['desg']);
die();
}
}
how to call another php file based on my radio button.Is there any other alternate way to call php file with passing arguments?
php
php
edited Nov 20 '18 at 5:57
antony
asked Nov 20 '18 at 5:48
antonyantony
16
16
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 '18 at 6:47
i try that method not working in my form
– antony
Nov 20 '18 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 '18 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 '18 at 8:07
An aside: you might want to url encode your query string. Seeurl_encode
and/orhttp_build_query
.
– Progrock
Nov 20 '18 at 8:10
|
show 2 more comments
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 '18 at 6:47
i try that method not working in my form
– antony
Nov 20 '18 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 '18 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 '18 at 8:07
An aside: you might want to url encode your query string. Seeurl_encode
and/orhttp_build_query
.
– Progrock
Nov 20 '18 at 8:10
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 '18 at 6:47
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 '18 at 6:47
i try that method not working in my form
– antony
Nov 20 '18 at 7:41
i try that method not working in my form
– antony
Nov 20 '18 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 '18 at 8:05
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 '18 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 '18 at 8:07
What's the problem here, what isn't working?
– Progrock
Nov 20 '18 at 8:07
An aside: you might want to url encode your query string. See
url_encode
and/or http_build_query
.– Progrock
Nov 20 '18 at 8:10
An aside: you might want to url encode your query string. See
url_encode
and/or http_build_query
.– Progrock
Nov 20 '18 at 8:10
|
show 2 more comments
1 Answer
1
active
oldest
votes
Your page of form where you will create form
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="<?= $_SERVER['PHP_SELF'] ?>"method="post">
<!-- radio button -->
<input type="radio" name="sel" value="board">
<input type="radio" name="sel" value="your_other_value">
<!-- radio button -->
<!-- Drop Down -->
<input type="option" name="boardlist" value="board">
<input type="option" name="desgwise" value="Designation">
<!-- radio button -->
<input type="hidden" name="staff">
<input type="hidden" name="desg">
<input type="submit" name="search">
</form>
</body>
</html>
This is your export_data1.php file
<?php
if(isset($_POST['search'])){
if($sel == 'board'){
header('Location: export_data.php?num='.$_POST['boardlist'];
} else {
header('Location: export_data1.php?num='.$_POST['desgwise'];
}
}
?>
export_data & export_data1 have different format for export xlsx file
Is this Jeopardy? What's different with this approach here? What's$sel
?
– Progrock
Nov 20 '18 at 8:04
I assume the difference here is that instead of having two separate export scripts, you are merging them into one script. I think I prefer the separation of responsibility, unless the code is practically identical. Differentiated URLs could also be a good thing.
– Progrock
Nov 20 '18 at 8:17
i separate into two files. action="export_data1.php?desg=<?php echo $desg ?>" is it correct method to passing parameters
– antony
Nov 20 '18 at 8:58
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%2f53386954%2fhow-to-call-another-php-file-with-parameters%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your page of form where you will create form
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="<?= $_SERVER['PHP_SELF'] ?>"method="post">
<!-- radio button -->
<input type="radio" name="sel" value="board">
<input type="radio" name="sel" value="your_other_value">
<!-- radio button -->
<!-- Drop Down -->
<input type="option" name="boardlist" value="board">
<input type="option" name="desgwise" value="Designation">
<!-- radio button -->
<input type="hidden" name="staff">
<input type="hidden" name="desg">
<input type="submit" name="search">
</form>
</body>
</html>
This is your export_data1.php file
<?php
if(isset($_POST['search'])){
if($sel == 'board'){
header('Location: export_data.php?num='.$_POST['boardlist'];
} else {
header('Location: export_data1.php?num='.$_POST['desgwise'];
}
}
?>
export_data & export_data1 have different format for export xlsx file
Is this Jeopardy? What's different with this approach here? What's$sel
?
– Progrock
Nov 20 '18 at 8:04
I assume the difference here is that instead of having two separate export scripts, you are merging them into one script. I think I prefer the separation of responsibility, unless the code is practically identical. Differentiated URLs could also be a good thing.
– Progrock
Nov 20 '18 at 8:17
i separate into two files. action="export_data1.php?desg=<?php echo $desg ?>" is it correct method to passing parameters
– antony
Nov 20 '18 at 8:58
add a comment |
Your page of form where you will create form
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="<?= $_SERVER['PHP_SELF'] ?>"method="post">
<!-- radio button -->
<input type="radio" name="sel" value="board">
<input type="radio" name="sel" value="your_other_value">
<!-- radio button -->
<!-- Drop Down -->
<input type="option" name="boardlist" value="board">
<input type="option" name="desgwise" value="Designation">
<!-- radio button -->
<input type="hidden" name="staff">
<input type="hidden" name="desg">
<input type="submit" name="search">
</form>
</body>
</html>
This is your export_data1.php file
<?php
if(isset($_POST['search'])){
if($sel == 'board'){
header('Location: export_data.php?num='.$_POST['boardlist'];
} else {
header('Location: export_data1.php?num='.$_POST['desgwise'];
}
}
?>
export_data & export_data1 have different format for export xlsx file
Is this Jeopardy? What's different with this approach here? What's$sel
?
– Progrock
Nov 20 '18 at 8:04
I assume the difference here is that instead of having two separate export scripts, you are merging them into one script. I think I prefer the separation of responsibility, unless the code is practically identical. Differentiated URLs could also be a good thing.
– Progrock
Nov 20 '18 at 8:17
i separate into two files. action="export_data1.php?desg=<?php echo $desg ?>" is it correct method to passing parameters
– antony
Nov 20 '18 at 8:58
add a comment |
Your page of form where you will create form
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="<?= $_SERVER['PHP_SELF'] ?>"method="post">
<!-- radio button -->
<input type="radio" name="sel" value="board">
<input type="radio" name="sel" value="your_other_value">
<!-- radio button -->
<!-- Drop Down -->
<input type="option" name="boardlist" value="board">
<input type="option" name="desgwise" value="Designation">
<!-- radio button -->
<input type="hidden" name="staff">
<input type="hidden" name="desg">
<input type="submit" name="search">
</form>
</body>
</html>
This is your export_data1.php file
<?php
if(isset($_POST['search'])){
if($sel == 'board'){
header('Location: export_data.php?num='.$_POST['boardlist'];
} else {
header('Location: export_data1.php?num='.$_POST['desgwise'];
}
}
?>
export_data & export_data1 have different format for export xlsx file
Your page of form where you will create form
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="<?= $_SERVER['PHP_SELF'] ?>"method="post">
<!-- radio button -->
<input type="radio" name="sel" value="board">
<input type="radio" name="sel" value="your_other_value">
<!-- radio button -->
<!-- Drop Down -->
<input type="option" name="boardlist" value="board">
<input type="option" name="desgwise" value="Designation">
<!-- radio button -->
<input type="hidden" name="staff">
<input type="hidden" name="desg">
<input type="submit" name="search">
</form>
</body>
</html>
This is your export_data1.php file
<?php
if(isset($_POST['search'])){
if($sel == 'board'){
header('Location: export_data.php?num='.$_POST['boardlist'];
} else {
header('Location: export_data1.php?num='.$_POST['desgwise'];
}
}
?>
export_data & export_data1 have different format for export xlsx file
edited Nov 20 '18 at 10:29
Hola Soy Edu Feliz Navidad
3,38432340
3,38432340
answered Nov 20 '18 at 8:01
F5 BuddyF5 Buddy
3604
3604
Is this Jeopardy? What's different with this approach here? What's$sel
?
– Progrock
Nov 20 '18 at 8:04
I assume the difference here is that instead of having two separate export scripts, you are merging them into one script. I think I prefer the separation of responsibility, unless the code is practically identical. Differentiated URLs could also be a good thing.
– Progrock
Nov 20 '18 at 8:17
i separate into two files. action="export_data1.php?desg=<?php echo $desg ?>" is it correct method to passing parameters
– antony
Nov 20 '18 at 8:58
add a comment |
Is this Jeopardy? What's different with this approach here? What's$sel
?
– Progrock
Nov 20 '18 at 8:04
I assume the difference here is that instead of having two separate export scripts, you are merging them into one script. I think I prefer the separation of responsibility, unless the code is practically identical. Differentiated URLs could also be a good thing.
– Progrock
Nov 20 '18 at 8:17
i separate into two files. action="export_data1.php?desg=<?php echo $desg ?>" is it correct method to passing parameters
– antony
Nov 20 '18 at 8:58
Is this Jeopardy? What's different with this approach here? What's
$sel
?– Progrock
Nov 20 '18 at 8:04
Is this Jeopardy? What's different with this approach here? What's
$sel
?– Progrock
Nov 20 '18 at 8:04
I assume the difference here is that instead of having two separate export scripts, you are merging them into one script. I think I prefer the separation of responsibility, unless the code is practically identical. Differentiated URLs could also be a good thing.
– Progrock
Nov 20 '18 at 8:17
I assume the difference here is that instead of having two separate export scripts, you are merging them into one script. I think I prefer the separation of responsibility, unless the code is practically identical. Differentiated URLs could also be a good thing.
– Progrock
Nov 20 '18 at 8:17
i separate into two files. action="export_data1.php?desg=<?php echo $desg ?>" is it correct method to passing parameters
– antony
Nov 20 '18 at 8:58
i separate into two files. action="export_data1.php?desg=<?php echo $desg ?>" is it correct method to passing parameters
– antony
Nov 20 '18 at 8:58
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%2f53386954%2fhow-to-call-another-php-file-with-parameters%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
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 '18 at 6:47
i try that method not working in my form
– antony
Nov 20 '18 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 '18 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 '18 at 8:07
An aside: you might want to url encode your query string. See
url_encode
and/orhttp_build_query
.– Progrock
Nov 20 '18 at 8:10