Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP Code

Posted on 2012-12-24
5
Medium Priority
?
278 Views
Last Modified: 2013-01-20
Hi,

I put together a small app, but I want to make sure once a person hits the SUBMIT button it redirects to a processing message/page.  Does anyone have a code snippet for this?

Thanks
0
Comment
Question by:Jack_son_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 1336 total points
ID: 38719111
When the submit control is fired, the browser will direct all of the form contents to the URL of the action= attribute of the form tag.  It is explained here at PHP.net (See "Dealing with Forms")
http://php.net/tut.php
0
 
LVL 31

Assisted Solution

by:Marco Gasi
Marco Gasi earned 664 total points
ID: 38719113
I'm not sure about what you want, but a submit button is usually part of a form so I think you ahve something like this:

<form action="" method="post">
  <input type="checkbox" name="" value="" />
  <input type="radio" name="" value="" />
  <input type="text" name="" value="" />
  <input type="submit" name="submit" value="Submit" />
</form>

In order or process form data you have to set the action attribute of the form to the script which does the job:

<form action="myscript.php" method="post">

That's all, but I suppose now you'll ask something about myscript.php... :-)

Cheers
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1336 total points
ID: 38719117
If the action= attribute of the form tag is empty or omitted, the request will be send to the current URL.  This allows you to put the form script and the action script into the same script file.  Very handy for keeping your work organized!

Merry Christmas wishes to all, ~Ray
0
 

Author Comment

by:Jack_son_
ID: 38721308
Thanks, everyone.  Yes, what is your script, that would help a lot!

Here is what i have in the code at the bottom, when I hit submit, I would like it to revert to the processing screen since there is a small delay and then go to the next screen:

<body>
    <form name="formOnlinePayment" method="post" action="OnlinePaymentConfirmation.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="formOnlinePayment">
<div>
======================

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['formOnlineRequest'];
if (!theForm) {
    theForm = document.formOnlineRequest;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>

========================================

<a class='default' href='javascript:document.forms[0].submit();'>Save Changes</a>
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38799018
Thanks for the points, ~Ray
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question