Hello all,

I'm a learning php this year but i encounters some problems.

One of them is about php value. The problem is how do i do to prevent a php file from resending the same values into the database whenever the page is refreshed?

Anyone help?


Thanks,

Asep

The only way that I know of doing this is redirecting after the post. For such a reason I usually process my posts on a separate file and then redirect back.

or check for main fields of that post form...then i can be prevented...
for example...

$seq="select count(*) as cnt from tablename where username='".$_POST['username']."'";
sres=mysql_query($seq);
	$srow=mysql_fetch_assoc($sres);	
	
	if($srow['cnt']>0) {
	
		$errmsg="User with this Username already existed.";
		
	} else 
{
//do your insert operations..
}

and for empty fields doing client side validation is better...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.