HHawk Posted January 5, 2007 Share Posted January 5, 2007 Hi there,I have a question regarding forms.Currently we receive forms from our website, which is great and stuff, but there a lot of empty fields on our forms (since they are not all required to be filled in).Is there a way to remove the empty fields completely before the form in sent by email?So we get a cleaner order form by email?Please advice and thanks in advance. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted January 5, 2007 Share Posted January 5, 2007 [code]depends on how you process your form. if its just a case of you printing out each field in the form and its value then you could try:[code]$form_data = NULL:foreach($_POST as $key => $val);{ if (!empty($val)) { $form_data .= $key . ": " . $val . "\r\n"; }}[/code]then just email yourslef the $form_data string.[/code] Quote Link to comment Share on other sites More sharing options...
HHawk Posted January 5, 2007 Author Share Posted January 5, 2007 Well it's just a simple html form... Don't know if that information matters? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted January 5, 2007 Share Posted January 5, 2007 well you can only remove that information if it is processed by a server side script like php or asp other wise what you get is what you get. Quote Link to comment Share on other sites More sharing options...
dbrimlow Posted January 5, 2007 Share Posted January 5, 2007 Actually, SOMETHING processes the form and submits the data (variables).Even using a straight sendmail cgi determines the format sent.Unless you are using some scarey FrontPage extension thing. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted January 5, 2007 Share Posted January 5, 2007 well if you can edit that script then you strip out the rubbish. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 6, 2007 Share Posted January 6, 2007 If you really, really care, you could disable the inputs via JS before it gets submitted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.