How to pass values from lightbox to main page - php

My main application opens an user page. There are New / Edit / Delete buttons on the same page.
I am using Datatables Editor to display records. When I click on New button an lightbox opens up and the datatables editor build-in plugin shows add user template. When this template is submitted a new record is created. The backend has a AUTO_INCREMENT key which I want to be passed back to main page such that I display a message 'User ID : XXXXX has been created'
The issue is that even though I pass it as a session variable the main page which I believe since it is already loaded and cannot be refreshed after lightbox page is submitted - it never receives the updated session variable. As such session variable though set dynamically when user submits lightbox from backend is never seen in main page
How can I achieve the desired output?

Related

How to go back without asking to confirm resubmission of the form

I have a web page that loads all the data from a mysql database called datalist.php
From this page I can edit record by record with a button that redirects you to an editdata.php page adapted to the fid of the record.
Once edited as they want to see the changes, I don't redirect them to the main one letting them see the changes and simply clicking back or with a button they return to the datalist.php without any problem.
The button is this
echo "<p id='parrafo'><a style='padding:1px 20px'class='button rounded-0 primary-bg text-white w-0 btn_1 boxed-btn' href='javascript:history.back() '><--</a></p>";
PROBLEM
I added a search engine where the displayed data can be filtered.
When they use the search engine from datalist.php, I direct them to a page called search engine.php where, through a post method, I store what they are looking for in a variable and the data that users want appears.
But when they edit a filtered record, it is edited without problems, but when they go back, they return to the search engine.php and the message appears:
"Confirm form resubmission In order to display correctly, this web page needs the data you entered earlier. You can submit that data again, but that will cause the page to repeat all previous actions. Press Reload to submit the data and display the page.
Hit the page refresh button to resubmit the data needed to load the page."
Of course, if they update, they come back when the filtered data comes out.
Isn't there any way to store the variable used in the search so that when I go back I don't get this error or any solution??
simple! when user will submit form for that variable instead of making post request
option1: just use get request __url__?variable=... but this will not remember the variable when you go back
option2: store the variable in the cookie and just go to next page (eg. window.location.href = '...';). and in next page access the cookie from php.
If you are wanting to show the form to the user as a confirmation, but without the possibility of another post, then remove the form element and the button. Display all other boxes as they are (with the values populated from the POST array).
And display another message telling them that it has been successful.
You are using PHP, you can achieve this easily with it. If you are unsure, then post a short version of your code in a separate question.

Showing gated and ungated content based on form submission

I have a HubSpot form embedded into a WordPress page.
What I'm trying to achieve is gated and ungated content. See these use cases as an explanation:
User enters WordPress page for the first time on content that is gated by default (by gated
I mean it shows a form).
User fills out the form and gets redirected to whatever is specified as the redirect
option in HubSpot (the content is now ungated).
User closes the window but decided to back onto the WordPress page. Now, since the
user has already filled out the form (the cookie for hubspotutk
exists), I want the user to be redirected straight to the asset
(whatever is specified in the redirect option in HubSpot forms).
How far have I got?
I've created an ACF field in WordPress with radio buttons for Gated or ungated content. By default, all content is ungated.
I've then set a cookie based on this ACF field value. I.e. if the content is gated, resourceType cookie equals "Gated".
That's how far I have got.
The next steps (I think) would be to...
Only "ungate" the page if the user has filled out that form. For example, I've completed a form, the hubspotutk cookie value is "23a43a4a6de9c38f7657ebd08d574scf". How does HubSpot know which form this value is assigned to?
Other concerns:
If the user has filled out the form already, how to I redirect them straight to the asset? Is there a way to get the "redirect to another page" value in the image below as a variable?
I don't want to use HubSpot Forms API because I don't expect the admin to create the forms via the API. They'll want to create it via the HubSpot forms option.
Any ideas?

Why messages.blade.php is placed into master layout page rather than the page where I want redirect user to

I am new to Laravel as I was watching tutorials on Youtube. So, I have a question about why messages.blade.php file is included inside master layout page instead of the page where you want a user to redirect to and in that page you wanna show success message. Just imagine you have store method which creates new record and then insert it into database and after that you want to redirect user to, say, index page and in that page you want to show success message. So, is it ok if I include message only inside index.blade.php file

Wordpress user id

I have a custom page that submits a form to another custom Wordpress page. I need to check the userID on this page, so I do this :
$user_ID= get_current_user_id();
When i echo that variable I get 0. HOWEVER, if i access the page directly (without submitting the form) it shows the correct userID.
To make it stranger, when i submit the form my admin bar will disappear as if i wasn't logged in, again, if i access the page directly the admin page will appear.
What could be happening when i submit the form that will cause this?
I should mention the page im submitting to is a copy of page.php with a few lines of code to submit the variables to a database. Anybody have some suggestions?

Pass form data from block to a page view in Drupal

I am using the location module and views module for a postcode search, which works fine in a page display using views.
However I want the user to be able to enter their postcode into a block on the homepage and clicking submit my module sends them to the page created in views and the postcode is set as a session S_SESSION['postcode'] before sending to this page, next I want the location page to load but using the session to display the locations automatically.
Any ideas I am using hook_form_submit() and inside that declaring the $form_state as a session and then using $form_state['redirect'] to sent to the views page path.
Ok the way to do this, is to create a mini panel and assign the view to that mini panel and then select the submit handler to go to the views page.

Categories