Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

SmartyValidate::is_valid($_POST) problem...

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
AlessandroT
Smarty n00b


Joined: 06 Feb 2005
Posts: 2

PostPosted: Sun Feb 06, 2005 9:37 pm    Post subject: SmartyValidate::is_valid($_POST) problem... Reply with quote

Hi there,

I've got a strange problem. On my local machine the samples provide by SmartyValidate workes fine, but once I copy the files to my website on internet, Smarty won't validate.

SmartyValidate::is_valid($_POST) won't be valid, no matter I try... but on my local machine it works how is should be work.

Any Idea? Confused

index.php
[php]
<?php
session_start();
require('Smarty.class.php');
require('SmartyValidate.class.php');

$smarty =& new Smarty;

// required initialization
SmartyValidate::connect($smarty);

if(empty($_POST)) {
$smarty->display('form.tpl');
} else {
// validate after a POST
if(SmartyValidate::is_valid($_POST)) {
// no errors, done with SmartyValidate
SmartyValidate::disconnect();
$smarty->display('success.tpl');
} else {
// error, redraw the form
$smarty->assign($_POST);
$smarty->display('form.tpl');
}
}
?>
[/php]

form.tpl
[php]
<form method="post" action="test.php">

{validate field="name" criteria="notEmpty" transform="trim" message="Name must be filled in"}
Naam: <input type="text" name="name" value="{$name|escape}"><br />
<input type="submit">

</form>
[/php]

success.tpl
[php]
<html>

Oke

</html>
[/php]


Last edited by AlessandroT on Wed May 05, 2010 11:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Mon Feb 07, 2005 2:42 am    Post subject: Reply with quote

I didn't bother looking at your code since you say it works okay on one machine anyhow. Are you not getting any errors on the production machine? Make sure error reporting is at E_ALL and if you set php to log errors then make sure to check it out. Have you verified that the server is working properly (sessions, tmp directories, etc?) Did you remember to clear out the temp files (cache/compile) when you moved the site over?
Back to top
View user's profile Send private message
AlessandroT
Smarty n00b


Joined: 06 Feb 2005
Posts: 2

PostPosted: Mon Feb 07, 2005 9:47 am    Post subject: Reply with quote

I've allready solved the problem, by rebooting my laptop.... Confused

mayby it had to do with temp files.. But very strange anyway
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP