Jump to content

[SOLVED] submit form to self or another page


miinet

Recommended Posts

I'm wondering if it's possible to submit a form to itself if there were validation errors, but submit to another page if there weren't any errors? My script works, but I want to be able to submit to another page if there weren't any errors rather than submitting to itself. I just want it to submit to itself if there were errors and show the error fields in a different color.

 

function error($err, $field)
{
if($error[field])
{
	print("<td style=color:red>");
}
else
{
	print("<td>">;
}
}

function show_form()
{
//html code
//form action is blank right now
}

if(isset($_POST["Submit"])){
check_form();
}
else{
show_form();
}

function check_form()
{
//validation if else statements
//if there were errors then you show the form show_form()
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.