1

Is there any PHP code which will allow me to NOT submit any empty fields to the database. I have a form with about 200 fields, and a lot of the times many of them are empty.

How can I not add the empty values to the database? My table "jos_rsform_submission_values" in the database is getting full quickly due to this.

Any help would be appreciated.

2
  • This question is: Unclear what you are asking as mentioned by @jamesgarrett because your question is vague and offers no context. James is certainly qualified to offer you professional-grade support, but is currently unable to do so. As I read through several of your questions, many of them are closable as Unclear. Please improve all of your questions as much as you can so that each page is valuable to researchers and to ensure that you are receiving the best possible advice. Always endeavor to progress all of your questions to a system-recognized resolution Jun 21, 2018 at 22:50
  • ...I don't simply mean chuck a green tick on all of your pages, because that of course would not benefit anyone. Jun 21, 2018 at 22:53

1 Answer 1

2

There's no generic answer to the question because the code that sits between a form submission and a database table varies wildly from application to application. Perhaps more importantly, different applications will react differently if you add code to interfere with the way the data is stored and retrieved.

That being said, if it is mission critical to minimise the volume of your rsform submissions then you could turn off store in database for that form and then write some custom code to catch the submission in the after submission php option - then basically you would loop through your post, sanitize some data, exclude entries that you count as empty, json_encode the data and add to some custom table. But you're effectively writing a small application from scratch then.

And with that being said, I'm not sure what 'full' means in your question - surely it would be easier to have sufficient storage available.

5
  • Thanks for the thorough reply. I will have a look into what you mentioned.I think the best would be to just upgrade the servers, as some queries are taking a while to load. There isn't a storage space issue luckily.
    – MailBlade
    Apr 30, 2018 at 7:35
  • 1
    If you've got a query performance issue then your problem might be fixed by adding an index to a column in your db. If you're using phpMyAdmin it's easy to add and remove indexes so you can just play around until your query goes from 10 seconds to 10 ms. Apr 30, 2018 at 8:01
  • Thanks a lot @jamesgarrett ! I'll be having a look into the index. Can I index any table I wish to?
    – MailBlade
    Apr 30, 2018 at 13:00
  • 1
    Before you start indexing any columns you should run a slow query with debug on and have a look at whether its 1 slow query or a bunch of queries in a loop. As for adding arbitrary indexes, in general you can add indexes without doing any harm, but you may want to have a look at the rsform forum first cause you're probably not the first person to want to add some indexes. May 1, 2018 at 7:50
  • Thanks for the answer @jamesgarret. Appreciate it and I'll take a deeper look into the indexes and perform the slow query with debug as you mentioned.
    – MailBlade
    May 2, 2018 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.