HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Page Control in miniblocks

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#101618 (In Topic #19934)
Avatar

Community saint

Hi,

I want to be able to submit a html form from within side a miniblock.
In fact I would like to be able to redirect to the same page and make use of page events etc to make decisions as to what to show.

I have knocked up a comcode page and a miniblock and I can create a form that reads data and enumerations from the my MySql database - all good so far.

I would like to make use of $_PHP_SELF but it is always set to NULL after a submit button is clicked. I have tried making the action URL fully qualified and work from the page that I am currently on. But I either get a page not found error or it redirects me to the index.php and my sites homepage.

Have I reached the limits of what a mini block can do here ?

Or is my approach to processing a form wrong ?

Cheers
Ade
Back to the top
 
Posted
Rating:
#101619
Avatar

Setting action="#" on the form is a neat trick.

Make sure you have method="post" on the form, otherwise you'd need to mess about a lot to make sure you put in the GET parameters of the current URL as hidden inputs in the form.

If you do want to put in a real URL to action, then get_self_url_easy() is probably the best for you. Don't rely on anything PHP provides directly, they tend to be wrong/inconsistent/incomplete.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#101622
Avatar

Community saint

That makes sense and works well - thanks
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: