how to use php in custom toolbar form

One option you have is to use JS to create cookies that store the entered information. Here is an article that explains how to do this. The cookies will last even if a form fails to submit. Just make sure you delete the cookies after you use them. I believe it is a security risk if you make cookies and just leave them. My experience with cookies is limited so I’d say just try the article and it should work. This also allows you to avoid your php problem, though to be honest, I’d look more into that and try to figure out why the php is making your site crash. It’s definitely not supposed to do that.