Im currently trying to develop a form that can work fully without JavaScript.
Basicly i want the user to be able to do the following:
- Complete form
- Submit form
- Success(Update DB or what ever)
- Fail (Go back to step 1 but with data from step 1 before already there)
I was thinking of doing the following for example:
<input type="text" value="<?php checkPost(name);?>"/>
Then in check post doing something like:
function checkPost($name){
try{
return $_POST[name];
}
catch{
return "";
}
}
Would this stop the error:
Notice: Undefined index
Which means if the data wasnt posted then just set the value to "" but if it was posted then set the old value to it.
Is this the best way to do it can anyone tell me a smarter way to do this with my forms.
My form markup can be seen here: JS Fiddle