I have a problem with default value for $_POST; So i have a html form with textboxes and the informations is sent to a php script. The php script has a sql query that is being sent to my database. But if my textbox in html form is empty the query doesnt have a value. So i want to set my post to a default value 0 so it returns a value atleast.
So here is an example of html form (This is not my actuall script. Just an example.
Ok so this script will send both id and test textboxes will always have a number value. And it sends the information to testscript.php
Here is testscript.php example
Alright so now if i submit my html form to php script without inserting any text to the textboxes the query will look like this
But the query should be like this
So. I know i can use value attribute in the html tag but then the value will be visible in the textbox and i dont want that.
And i know i can do an if statment to make a default value like this
But now the problem is that i would have to do that if statment for every textbox and my html form have more than 100 textboxes. So i dont want to make an if statment for every textbox because then my script will be way to big and it will take hours.
So is there any way to set a default value for all the textboxes without using if statment in php or value attribute in html form?
- Why do plants change gender
- What was Louis de Broglies discovery
- What happened in Hyderabad
- When will admissions start in NICMAR
- Why is Concerta better than Adderall
- What outfits should teachers never wear
- What are the different types of snipers
- When will industrialization lose its effect
- What does the word jentacular mean
- Is brass a brittle material
- Why do we have weeks
- What are the UPSC exams like
- How is vaping with flavors harmful
- Where are TOEFL test scores accepted
- Why is Code School not free
- What are multivibrators
- Is Start Up Dubai a legitimate business
- Why would anyone buy Greenland