| | |
Receiving a POST data
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 491
Reputation:
Solved Threads: 0
Hi,
We can code this way to print something if Exit button is clicked.
What about if we use this way. How do i check if Exit button was clicked or not?
Thanks in advance
We can code this way to print something if Exit button is clicked.
PHP Syntax (Toggle Plain Text)
<form action="process.php" method="POST"> <input type="hidden" name="hiddenName" value="Jolly" /> <input type="submit" name="submit" value="Exit" /> </form> if($_POST["submit"] == "Exit") { echo $_POST["hiddenName"]; }
What about if we use this way. How do i check if Exit button was clicked or not?
PHP Syntax (Toggle Plain Text)
<form name="formExit" action="process.php" method="POST"> <input type="hidden" name="hiddenName" value="Jolly" /> <a href="#" onclick="document.formExit.submit()" title="Exit">EXIT</a> </form> if( ???????????? == "Exit") { echo $_POST["hiddenName"]; }
Thanks in advance
0
#2 Oct 12th, 2009
•
•
•
•
Hi,
We can code this way to print something if Exit button is clicked.
PHP Syntax (Toggle Plain Text)
<form action="process.php" method="POST"> <input type="hidden" name="hiddenName" value="Jolly" /> <input type="submit" name="submit" value="Exit" /> </form> if($_POST["submit"] == "Exit") { echo $_POST["hiddenName"]; }
What about if we use this way. How do i check if Exit button was clicked or not?
PHP Syntax (Toggle Plain Text)
<form name="formExit" action="process.php" method="POST"> <input type="hidden" name="hiddenName" value="Jolly" /> <a href="#" onclick="document.formExit.submit()" title="Exit">EXIT</a> </form> if( ???????????? == "Exit") { echo $_POST["hiddenName"]; }
Thanks in advance
html Syntax (Toggle Plain Text)
<script type="text/javascript"> function submitForm(val) { document.getElementById('submitted').value = val; document.getElementById('submitted').form.submit(); } </script> <form action="process.php" method="post"> <input type="hidden" name="submitted" id="submitted" value="" /> <a href="#" onclick="submitForm('EXIT');">EXIT</a> </form>
Last edited by ShawnCplus; Oct 12th, 2009 at 1:34 pm.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: Oct 2009
Posts: 4
Reputation:
Solved Threads: 1
-1
#3 Oct 13th, 2009
•
•
•
•
PHP Syntax (Toggle Plain Text)
<form name="formExit" action="process.php" method="POST"> <input type="hidden" name="hiddenName" value="Jolly" /> <a href="#" onclick="document.formExit.submit()" title="Exit">EXIT</a> </form> if( ???????????? == "Exit") { echo $_POST["hiddenName"]; }
PHP Syntax (Toggle Plain Text)
foreach $_POST as $key -> $value { if ($value == 'Exit') $echo $_POST['hiddename']; }
0
#4 Oct 13th, 2009
•
•
•
•
PHP Syntax (Toggle Plain Text)
foreach $_POST as $key -> $value { if ($value == 'Exit') $echo $_POST['hiddename']; }
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: Oct 2009
Posts: 4
Reputation:
Solved Threads: 1
0
#5 Oct 14th, 2009
I don't have much experience with PHP as I have only done one useful script with it so far for uploading .PDFs as BLOBS, searching them, and downloading them. I am definitley still learning and I was wondering if you could tell me what is wrong with the technuique I used? Is it more efficient to use javascript than looping through the entire $_POST array? Or is it just not good PHP practice? Thanks.
•
•
Join Date: Sep 2009
Posts: 521
Reputation:
Solved Threads: 61
0
#6 Oct 14th, 2009
PHP Syntax (Toggle Plain Text)
if(isset($_POST["submit"] ) && $_POST["submit"] == "Exit") { //your code here }
•
•
Join Date: Apr 2008
Posts: 491
Reputation:
Solved Threads: 0
0
#7 Oct 14th, 2009
Thanks to ShawnCplus. Solved.
PHP Syntax (Toggle Plain Text)
<script type="text/javascript"> function submitForm(val) { document.getElementById('submittedName').form.submit(); } </script> <form action="process.php" method="post"> <input type="hidden" name="hiddenName" id="submittedName" value="Jolly" /> <a href="#" onclick="submitForm('this.hiddenName');">SUBMIT</a> </form>
PHP Syntax (Toggle Plain Text)
<?php echo $_POST["hiddenName"]; ?>
0
#8 Oct 14th, 2009
•
•
•
•
Thanks to ShawnCplus. Solved.
PHP Syntax (Toggle Plain Text)
<script type="text/javascript"> function submitForm(val) { document.getElementById('submittedName').form.submit(); } </script> <form action="process.php" method="post"> <input type="hidden" name="hiddenName" id="submittedName" value="Jolly" /> <a href="#" onclick="submitForm('this.hiddenName');">SUBMIT</a> </form>
PHP Syntax (Toggle Plain Text)
<?php echo $_POST["hiddenName"]; ?>
document.getElementById('submittedName').value . But since you're not really setting the value anyway you can just remove the val argument altogether and remove 'this.hiddenName' from submitForm() GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
![]() |
Similar Threads
- Post data to remote server without cURL (PHP)
- Button to send POST data (JavaScript / DHTML / AJAX)
- POST data issue when return to page (PHP)
- Simple question: Popup page to post data to mother page (PHP)
- i want to post data with screen scrap page.. (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: I have a problem in my table
- Next Thread: Problem with file Upload ...
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube






