On 7/24/07, Daniel Brown <parasane@xxxxxxxxx> wrote:
On 7/23/07, Daniel Kasak <dkasak@xxxxxxxxxxxxxxxxxxxx> wrote: > Thanks for the response Dan. Us Dans have to stick together :) > > On Mon, 2007-07-23 at 17:37 -0700, Dan wrote: > > > Then validate the field obviously! > > $description = ""; > > $categoryid = ""; > > > > if(isset($_POST['description'])) > > $description = "?description=$_POST['description']"; > > > > if(isset($_POST['categoryid'])) > > { > > if($description != "") $categoryid = "&"; else $categoryid = "?"; // if a > > description has been entered you'll need an & symbol otherwise a ? > > $category .= "categoryid=$_POST['categoryid']"; // append category to > > itself with the posted info > > } > > Hmmmm. Yeah I thought it would come to that. I was hoping for a quick & > nasty fix. > > > I didn't test this it's just off the top of my head, also you should > > sanitize the input before you do anythign with it really, but that's another > > issue. Also this is really something that you should be doing with ajax > > rather than having the page reloading, and passing variables back, etc. > > This is the EXACT purpose that Ajax as made for, validation of info. Check > > out XAJAX it's very simple to use but powerfull when you need it. > > I will try to make some time for investigating ajax. I'm mostly > developing in Perl, and doing nice GUI stuff ( ie no web stuff - this is > a once-off maintenance thing ), so I'll a little out of my comfort > zone ... > > Thanks again for your help. > > -- > Daniel Kasak > IT Developer > NUS Consulting Group > Level 5, 77 Pacific Highway > North Sydney, NSW, Australia 2060 > T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 > email: dkasak@xxxxxxxxxxxxxxxxxxxx > website: http://www.nusconsulting.com.au > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Hello, Dans! Dan K., is there any reason the validation can't reside within the same script as the form, then forward on success? A very simple example: <? if($_POST) { // Check to ensure that your variables are all correct, // then use header("Location: successful-target.php?var1=a&var2=b"); // And then, on forwarding, remember to exit; } ?> <FORM METHOD="POST" ACTION="<?=$_SERVER['PHP_SELF'];?>"> <INPUT TYPE="TEXT" NAME="var1" VALUE="<?=$_POST['var1'];?>"><BR /> <INPUT TYPE="TEXT" NAME="var2" VALUE="<?=$_POST['var2'];?>"><BR /> <INPUT TYPE="SUBMIT" VALUE="GO!"> </FORM> Since the user will start with a blank form, and the $_POST values won't already be set, the values in the form will be blank on the initial page load, but for unsuccessful attempts, they'll be populated with the correct data. ~ Dan^[3] -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107
Note that if you have E_NOTICE set in error reporting level, then this gives some warnings about undefined variables! Tijnema -- Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php