how to call another php file with parameters?
up vote
-1
down vote
favorite
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
up vote
-1
down vote
favorite
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 at 6:47
i try that method not working in my form
– antony
Nov 20 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 at 8:07
An aside: you might want to url encode your query string. Seeurl_encode
and/orhttp_build_query
.
– Progrock
Nov 20 at 8:10
|
show 2 more comments
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
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 at 5:57
asked Nov 20 at 5:48
antony
16
16
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 at 6:47
i try that method not working in my form
– antony
Nov 20 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 at 8:07
An aside: you might want to url encode your query string. Seeurl_encode
and/orhttp_build_query
.
– Progrock
Nov 20 at 8:10
|
show 2 more comments
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 at 6:47
i try that method not working in my form
– antony
Nov 20 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 at 8:07
An aside: you might want to url encode your query string. Seeurl_encode
and/orhttp_build_query
.
– Progrock
Nov 20 at 8:10
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 at 6:47
possible duplicate of stackoverflow.com/questions/5678567/…
– Jacob Nelson
Nov 20 at 6:47
i try that method not working in my form
– antony
Nov 20 at 7:41
i try that method not working in my form
– antony
Nov 20 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 at 8:05
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 at 8:07
What's the problem here, what isn't working?
– Progrock
Nov 20 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 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 at 8:10
|
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
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 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 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 at 8:58
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
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 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 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 at 8:58
add a comment |
up vote
0
down vote
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 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 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 at 8:58
add a comment |
up vote
0
down vote
up vote
0
down vote
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 at 10:29
Hola Soy Edu Feliz Navidad
3,32932339
3,32932339
answered Nov 20 at 8:01
F5 Buddy
3024
3024
Is this Jeopardy? What's different with this approach here? What's$sel
?
– Progrock
Nov 20 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 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 at 8:58
add a comment |
Is this Jeopardy? What's different with this approach here? What's$sel
?
– Progrock
Nov 20 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 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 at 8:58
Is this Jeopardy? What's different with this approach here? What's
$sel
?– Progrock
Nov 20 at 8:04
Is this Jeopardy? What's different with this approach here? What's
$sel
?– Progrock
Nov 20 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 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 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 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 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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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 at 6:47
i try that method not working in my form
– antony
Nov 20 at 7:41
An alternative could be to have bog standard links to your files.
– Progrock
Nov 20 at 8:05
What's the problem here, what isn't working?
– Progrock
Nov 20 at 8:07
An aside: you might want to url encode your query string. See
url_encode
and/orhttp_build_query
.– Progrock
Nov 20 at 8:10