Submit a Login form using data received in another form - javascript

I have a login form in my webpage. How can I access data in the login form in my webpage and inject the received data in another third party login form which i don't have any end level access and auto-click submit button.

Your question is a little confusing, so let me try to understand:
you are trying to carry the information received from a form throughout multiple ".php" pages?
İf so, you can use the $_SESSION command. More information here, however this is briefly how you can use it.
You start with a
<?php
session_start();
$_SESSION["information"] = informationToCarry;
?>
By opening with a session_start at the beginning of every page, you will be able to retrieve that information with the same syntax
$_SESSION["information"];
Please be a little more clear next time,
Good Luck

Related

How can I transfer the information I get from the form to another page?

How can I show the information I got from the place where I entered the title and text on the announcement page?
repo:https://github.com/qswezy/spa1
We have added the form and we want to show it in the announcements
Forms usually have target page. So, this is the page that will receive your submitted data, usually in some type of POST array (if you submitted it as a post.) If this assumes JavaScript, you probably need to run an Express server to do this.

How to perfom 2 different actions using only 1 submit button on a form

I have a submit button for logging into my PHP/MySQL system. However, I would like to able to log in and at the same time take the credentials and store them in indexedDB when the button is clicked, is there any way of achieving 2 actions at the same time. So far if I include my javascript code for submitting to indexedDB, the login does not work, and if I remove the code, the login works.
What you could do is have your form take you to your first page, then do both the actions with all the data send to your form.
With a simple HTML/PHP form, this is simple. Submit the form to a new PHP page using action="submit.php". Then do your indexedDB call on this page, and echo out a copy of the form, complete with the data (POST or GET), but with your login page as the newactionthen echo a` tag like so:
echo "<script>document.getElementById('myForm').submit();</script>";
Then it will login via your login page.
If you want to save data in IndexedDB before logging in the user:
You can achieve this by calling a javascript function onSubmit. And inside that function, you can hit a GET/POST URL to save data in Indexed DB.
OR if you want to perform this task on the server side then One way of doing this is: Upon successful login or while verifying user's credentials, you can call a function to save data in your indexedDB. This function could be sync or async.
onclick="doSomething();"
function doSomething(form){
// do something
// do something else
// Finally submit the form
form.submit();
return true;
}
seperate with two ;
onclick="doSomething();doSomethingElse();"
You're good to go!

repopulating $_POST variables transparently in PHP

So.
In a LAMP stack (PHP), I've got this situation where I'm showing an intermediate page based on some variable from the first page --more simply, I have one page called, say, ListOfProjects, from which I can select a project to view.
When I go to that project, there are other page-navigation elements (like looking at individual jobs in the project, say) the user can click. Once I click them, and am navigated away from the intermediate page between ListOfProjects and IndividualJob, I have to resubmit the data that got me there.
That's fine, and if I could do it automatically, I would. However, I haven't found a way to force this behavior and eliminate the extra click and the ugly "Confirm Form Resubmission" screen.
Does anyone know a way I could A) silently force form-resubmission when the user hits the back button or B) avoid the situation where there's a form that needs resubmitting?
I've thought about trying to just pass that project ID to the session variable, but it's well within scope to have more than one individual project open in the same browser, which would make that unwieldy.
Thoughts? Suggestions?
Thanks!
Don't use POST.
When you are getting data from the server, use GET and put the data in the query string.
POST is designed for sending data to the server that will make a change (e.g. updating data in the database), it isn't appropriate for just deciding what data to look at.
Some solution is bypass using jQuery to resubmit a form when click on back:
<?php if (isset($_POST['ListOfProject'])): ?>
<form method="POST" id="backToProject"></form>
<script>$("#backToProject").submit()</script>
<?php endif ?>
Another solution is to use header("Location: ...") to force users to redirect a page, BUT you should remove all previous $_POST request using unset($_POST) such as:
unset($_POST);
header("Location: your_uri://your_path");
Try reload a page and reload a page using javascript into <script> tag such as:
if ($_POST['ListOfProject'])
{
echo '<script type="text/javascript">location.reload();</script>';
}
Try to understand GET/POST method: https://en.wikipedia.org/wiki/Post/Redirect/Get
And I don't recommended using link of sites using $_POST method such as say Quentin user.

Trying to save Multi-Value Form on server for users to call up during another session

been searching here for a while on how to save form information to be re-called later.
Here is my site: http://d3barb.com
The purpose is people fill out the 100+ fields in the form and it will generate numbers corresponding to the game Diablo 3. The formulas all work perfectly, and sometimes the cookie will save the information, but I'm trying to figure out a way to save the entire "page", so users can call them up during a different session.
I've tried for about 6 hours to get setCookie / getCookie functiond to create a cookie with all the values saved, but can't seem to get it to work. Even if it was working, it would only allow the user to load their last seission when re-visiting the site.
How I would like it perform:
1.) User inputs information for the form to calculate.
2.) User fills out a "name" text field and hits a "Save" button (I have these on my test page, but don't want it live until its working), which will save the values on my server containing all the form information as they've entered it.
3.) The next time that User visits the page, they would hit "Load" to call up a previous session.
I'd like to avoid user-account log-ins, so if possible I'd like the server to save the sessions by IP address & user submitted session name, something like: 142.105.103.125.fire crusader
Currently, the page is html with js calculating everything. I can convert it php for server interaction, but if there is another way, I'm all ears.
I'm not looking for handouts, so any links to tutorials would be greatly appreciated. If someone has done something similar to this and wouldn't mind sharing that page or code with me, I can do my best to frankenstein it for my page. (pretty much how I do all my websites haha!)
Have you tried/considered HTML 5 local storage?
http://www.sitepoint.com/html5-web-storage/
should get you started :)

Pass form data onto next page as text

I have an email sign up form generated by our ESP plugged into a webpage. When the user clicks submit, it takes them to a custom confirmation page we have created. I would like to display the email address they submitted on the confirmation page, so it says something like, 'Thanks for joining, you will now receive emails at [email address]'. Our ESP does not provide a way to do this. Is there is a simple way I can grab the email address from the form and pass it to the next page with JavaScript?
I've tried the solutions presented here, but if I try to update the form tag, the form breaks: http://www.webdeveloper.com/forum/showthread.php?232612-Pass-Variables-from-one-page-to-another-JAVASCRIPT-HTML
I found this article online but I don't understand how the cookie will record only the email address or how to retrieve this information on the next page: http://webdesign.about.com/od/cookies/a/aa083198.htm
Here is the current form code on my page:
<script type="text/javascript" src="https://app.e2ma.net/app2/audience/tts_signup/1723547/4d1180e592869543e75486faa4eb9d23/37406/?v=a"></script>
<div id="load_check" class="signup_form_message">
This form needs Javascript to display, which your browser doesn't support. Sign up here instead
</div>
<script type="text/javascript">signupFormObj.drawForm();</script>
I have very limited understanding of JavaScript and no understanding of PHP so the more specific reply you could give, the better. Any help is greatly appreciated. Thank you.
since you are submitting a form, hence have access to the email adress on the server side, why don't you just output it?
Javascript looses connection between pages as soon as it unloads. Your attempt to do this with javascript is WAYYYYYY to complicated for something HTML1 was able to do.

Categories

Resources