Zend: WTF
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Here is what I am trying to do...feyd wrote:This bit doesn't make sense. Grammatically I can't figure out what specifically you mean.Hockey wrote:I need to carry out the process concurrently so when the page is requested the POST data is displayed in the FORM elements...
I have a FORM (subject A) and a script (subject B)
Subject A is submitted to subject B but B resides in another directory.
When A is submitted to B. B will check, validate and sanitize POSTed data, but if anything goes wrong, it will POST that data back to A
A echo'es POST data in the INPUT value=""
This will allow people to make corrections without using "Back" and potentially loosing data, passwords, etc...
I'm am emulating a postback which is supported in .NET at least I think I am
B cannot just simply send a POST command to A and then use a header() redirect as I don't think that would work, as the redirected page would *not* have the original FORM data and persistence is lost...
I know there are others way to acheive this, but this is the solution I have chosen for specific reasons...
What I need is the answer to my problem...
How do I use the Zend Framework to accomplish what I am trying to do???
First person who helps me...gets my respect for a whole week
Cheers
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Code: Select all
header("HTTP/1.0 307 Temporary redirect");or for a more 'real' solution, you could try out PECL's Http extension.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
According to http://ppewww.ph.gla.ac.uk/~flavell/www ... irect.html I just read that shouldn't be used as it requires client confirmation before the redirect excutes...or something to that effect...Jenk wrote:Code: Select all
header("HTTP/1.0 307 Temporary redirect");
or for a more 'real' solution, you could try out PECL's Http extension.
Besides, that isn't quite what I'm trying to do...I need to have the Query String and POST data sent back to the original FORM (the query string I left out previous because I forgot).
Here is a hack of what I am trying to do:
This code is inside the script which gets called inside the original FORM...it'll be displayed when something fails, but won't display anything if the browser supports Javascript, otherwise, a submit button will be displayed...inside noscript...
Doesn't look like the Zend_Http_Client supports query strings though as I just stumbled across a todo:
I guess for now this hack will do, until I spend some more time in figuring out a better solution or something...
Code: Select all
<html>
<body onload="document.forms[0].submit()">
<noscript>
An error occurred, plese click here to be redirected
</noscript>
<form action="../index.php?page=postad" method="post">
<input type="hidden" name="first_name" value="<?=$first_name;?>" />
</form>
</body>
</html>
sounds like you want the equivalent of ASP's Server.transfer()
You could implement the below 'hack' for now:
the action page:
according to Marcot on phparch.com such functionality does not exist within PHP. 
You could implement the below 'hack' for now:
the action page:
Code: Select all
if (!allFieldsAreValid($_POST)) {
include 'thePageWithTheFormOnIt.php';
die;
} else {
//do the other stuff
}-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
I don't think that's it either...basically the hack I have shown is exactly what I want done, but preferably on the server side, so people with javascript turned off don't need to click a button. Otherwise everything is perfect just a little hackish in feel...Jenk wrote:sounds like you want the equivalent of ASP's Server.transfer()
You could implement the below 'hack' for now:
the action page:according to Marcot on phparch.com such functionality does not exist within PHP.Code: Select all
if (!allFieldsAreValid($_POST)) { include 'thePageWithTheFormOnIt.php'; die; } else { //do the other stuff }
The "scripts" and "primary display engine (index.php)" are 2 different files...
The "scripts" or actions are implemented in seperate modules for efficiency, I'm using a *very* minimized version of MVC, actually my understanding is it wouldn't be MVC strictly speaking but does promote the same kind of seperation...
index.php acts as a front controller...but does a little more as well...which is outside the domain of a FC...
It selects templates and querys model's, the templates occasionally conatin FORM html which have action attributes specified...those actions instigate the "scripts" or actions which are stored in a sub directory.
If you wonder why I don't just throw everything into a single index.php and model more accurately after MVC, I am favouring efficiency over code readability. Minimize parsing time, etc...
I'm using as many optimization techniques as I can...as it's important this site runs fast...besides the code is completely readable by me...and more organized than many more successful open source projects...so I'm sure it won't be an issue in the future...but I still may one day switch to a true MVC model...
I cannot use tehcniques like you have described...at least not how I understand the problem...
I am positive using sockets and a solid understanding of HTTP would allow me to accomplish what I want too, but my mediocre understanding of HTTP and trivial understanding of sockets isn't helping...
If you can do it with a browser in HTML and FORM's...I can't see how it wouldn't be possible using just HTTP...a script simply needs to emulate an HTML FORM action...I'm sure it's possible...just not as obvious or easy...how does a browser do it if it's not possible?
Cheers