Jump to content

help passing hidden variables


droopz17

Recommended Posts

My site involves a header ( nav goes between header and middle ) middle ( main content goes between middle and footer ) and footer.

 

exp:

include('header.php')

include('nav.php')

include('middle.php')

main content.php

include('footer.php')

 

well i want to have it so that when someone fills out a form wrong it submits an error message and displays it at the top of the main content using middle.php but i'll have the footer.php collect all the error messages which are being assigned to "$em.= 'my errors';" using a hidden field and using header to redirect back to the same page.

 

If i have footer echo the em then the problem is that it shows all my content and then the error message at the bottom. So i was thinking i could have it take the $em variable and redirect to the same page using a hidden field so that it can be displayed in the middle.php which will show the errors messages on the top of all my content.

 

here's how it goes

 

header

nav

middle

 

if error message then redirect along with hidden variable ($em) and diplay using middle

 

else

 

display form

 

footer.

 

so if you can see i have it displaying the form or the error and i think i just thought of how to fix it but i'm gonna leave this up still.

 

 

I could do it as " echo 'my error message'; but i want it to be setup so that all my message look exactly the same and all i have to do is change the error message display in the middle.php if i want to change the format at all.

Link to comment
Share on other sites

www.php.net/session

 

You want to use session's which will essentially hide the "Errors"

 

Another alternative is to you AJAX and never really "Refresh" the page and just have the error check done on its own. Either way should give you your desired result.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.