Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Use of Form - looping within a page
Old 01-05-2010, 02:32 PM Use of Form - looping within a page
Junior Talker

Posts: 2
Name: J.C. Love
Trades: 0
Tried everything I can think of... maybe this isn't possible:

I'm using Javascript to use a link to make a hidden DIV visible. This link and the DIV need to be in a header.html file that each page of the site loads with "require, and contains the code to set up a banner and links that appear on every page of the site.

Within the now hidden DIV, I want to use a FORM tag to create a couple of text boxes, and then use the method="POST" to loop and validate the text box entries. The code looks like...
<?php
$page = "... current page name ..." // this is set in the page before the
// header.html page loads
?>
<DIV id="hidden_div" class="hidden">
<?php
if (isset($_POST['submitted'])) {
-validation section -
} // End submitted
?>
<form action="...this is where I have a problem..." method="POST">
<input blah blah>
<input blah blah>
<input style="link" type="submit" name="submit" value="Continue" />
<input type="button" value="Quit" onClick="javascript:hide('hidden_div") />
<input type="hidden" name="submitted" value="true" />
</form>
</DIV>


Ordinarily I'd use action="{page name}" so the page would reload from the beginning. However, I can't do that because I can't figure out how to identify the current page within the Form tag. The current page is held in a $page variable. So I would need to create the 'action' tag that resolves $page to the actual page name. And even then, I'm not sure the now visible DIV would still be visible, and less sure that the validation section would be accessed properly.

The other thought I have is to use the "action" tag to loop to the beginning of the DIV... I don't know if that's possible, either. I've tried using an anchor. Didn't work for me.

I'm reasonably sure that there is a method to do what I want... maybe something completely different from my two thoughts.

I hope this is clear. Help, anyone?...
jclove is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-05-2010, 02:48 PM Re: Use of Form - looping within a page
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use a hidden field that is populated by the same javascript
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-05-2010, 04:24 PM Re: Use of Form - looping within a page
Junior Talker

Posts: 2
Name: J.C. Love
Trades: 0
Thanks for your response, chrishirst.

I'm afraid I need more to understand your thought. Could you be more specific, and/or give an example?
jclove is offline
Reply With Quote
View Public Profile
 
Old 01-05-2010, 07:46 PM Re: Use of Form - looping within a page
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
having read the post again I'm not sure I see the problem.

action="" will submit the page to itself so you can use PHP_SELF to determine the page name
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Use of Form - looping within a page
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14612 seconds with 12 queries