Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within PHP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
PHP
PHP $_POST variable lost after a jquery submit
Jacky Luk
Ranch Hand
Posts: 634
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
In the $(document).ready function, the $_POST['displayDoc] has become null again or undefined.
Why?
Thanks
Jack
<!DOCTYPE html> <html> <body> <?php if (isset($_POST['displayDoc'])) { $itemNo = $_POST['displayDoc']; var_dump($itemNo); echo '<form id="displayDocForm" action="../common/displaySupportDoc.php" method="POST" enctype="multipart/form-data"> <input type="hidden" name="itemNo" value=' . $itemNo . '> </form>'; } ?> <script src="../vendors/jquery-1.9.1.min.js"></script> <script> $(document).ready(function(){ if (isset($_POST['displayDoc'])) { $("#displayDocForm").submit(); } }); </script> </body> </html>
Roel De Nijs
Sheriff
Posts: 11606
178
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Jacky Luk wrote:
Why?
It's php-code, but I don't see any php-tags. I would expect something like:
$(document).ready(function(){ <?php if (isset($_POST['displayDoc'])) { ?>$("#displayDocForm").submit();<?php } ?> });
SCJA
, SCJP (
1.4
|
5.0
|
6
),
SCJD
OCAJP 7
Jacky Luk
Ranch Hand
Posts: 634
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks man
Jack
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Error in reading uploaded file name
Writing to web space from Java applet.
Javascript and PHP
Problem adding id field to script tag.
multiple occurrence of a word in a String
More...