| | |
Posting data behind the scene
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
1
#2 Nov 6th, 2009
You can use AJAX to post form data. Take a look at this link http://www.captain.at/howto-ajax-form-post-request.php
-1
#3 Nov 6th, 2009
0
#4 Nov 6th, 2009
•
•
•
•
Hi,
index.php posts data to process.php
I want users to remain in index.php when they summit their form. I have seen this in some websites but don't know hot it done.
Can anyone help me?
Thanks
html Syntax (Toggle Plain Text)
<form action="index.php" method="post" > <!-- your form inputs here --> <input type="submit" name="submit" value="Submit" /> </form>
and at the top of your index.php before the header should look something like
php Syntax (Toggle Plain Text)
<?php if(isset($_POST['submit'])) { // do stuff here } ?> // continue to display what was intended for the visitors first visit to the page if submit was not detected.
hope that helps
@ I'm gonna live forever, or die trying.
@ A wise man once told me, in order to understand recursion, you first must understand recursion.
@ A wise man once told me, in order to understand recursion, you first must understand recursion.
0
#5 Nov 6th, 2009
This wont be a solution what he is looking... he wants index.php to submit data to process.php
n btw even if u submit the data to same page, the page gets refreshed which can be avoided only by asynchronous data transfer possible through AJAX.
n btw even if u submit the data to same page, the page gets refreshed which can be avoided only by asynchronous data transfer possible through AJAX.
•
•
•
•
All you need to do is submit the page to itself from the form tag. you will also need to make sure you give your submit button a name attribute. For example.
html Syntax (Toggle Plain Text)
<form action="index.php" method="post" > <!-- your form inputs here --> <input type="submit" name="submit" value="Submit" /> </form>
and at the top of your index.php before the header should look something like
php Syntax (Toggle Plain Text)
<?php if(isset($_POST['submit'])) { // do stuff here } ?> // continue to display what was intended for the visitors first visit to the page if submit was not detected.
hope that helps
0
#6 Nov 6th, 2009
Apologies you are correct, I misread the original post.
@ I'm gonna live forever, or die trying.
@ A wise man once told me, in order to understand recursion, you first must understand recursion.
@ A wise man once told me, in order to understand recursion, you first must understand recursion.
0
#10 Nov 8th, 2009
sure this will do the trick but i dont feel its a healthy practice as the user will get a window flashed in front n then disappearing....
Also, after closing the process file, how will u update the values in original index.php without refreshing it... I agree u will submit the form but u need to show a success or error message to user regarding it...
so best way to achieve this(AFAIK) is AJAX
Also, after closing the process file, how will u update the values in original index.php without refreshing it... I agree u will submit the form but u need to show a success or error message to user regarding it...
so best way to achieve this(AFAIK) is AJAX
Gimme reputation points if u find my post helpful.
use [code] tags wherever applicable
dont start a new thread unless u cant find the topic already on forum.
mark a thread "solved" as soon as u get a solution
use [code] tags wherever applicable
dont start a new thread unless u cant find the topic already on forum.
mark a thread "solved" as soon as u get a solution
![]() |
Similar Threads
- Posting data from x to y to be processed ? (PHP)
- POSTing data to web page (Python)
- Autmating posting data to a php-based website (PHP)
- Button to send POST data (JavaScript / DHTML / AJAX)
- Simple question: Popup page to post data to mother page (PHP)
- JavaScript posting data (JavaScript / DHTML / AJAX)
- Data Extraction (Visual Basic 4 / 5 / 6)
- posting data from a form to msg broker fail (RSS, Web Services and SOAP)
- Challenging Problem in PASSing Data to Server, Plz Help (ASP)
Other Threads in the PHP Forum
- Previous Thread: Returns only 1 record from mysql database..:(
- Next Thread: how to write regular expression in PHP?
Views: 506 | Replies: 20
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array autosuggest beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email emptydisplayvalue error explodefunction file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery keywords limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search searchbox select server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube






