ltoto Posted September 26, 2006 Share Posted September 26, 2006 i have fotton basically how to do the thing in forms when you must fill in certain feilds of the form before you can sumbit it.So here is a form for example:[code]<form name="flights" method="POST" action="<?php echo $editFormAction; ?>"> <h2>Flights Enquiry Form</h2> <br> <label for="selectTitle">Title:</label> <select name="selectTitle" id="selectTitle"> <option selected value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Ms">Ms</option> <option value="Miss">Miss</option> </select> <br> <label for="txtInitial">Initial:</label> <input name="txtInitial" type="text" id="txtInitial" size="5"> <br> <label for="txtSurname">Surname:</label> <input name="txtSurname" type="text" id="txtSurname"> <br> <label for="txtDept"> Dept Airport:</label> <input name="txtDept" type="text" id="txtEmail" size="25"> <br> <label for="txtDest">Destination Airport:</label> <input name="txtDest" type="text" id="txtEmail" size="25"> <br> <label for="selectDuration">Duration: </label> <select name="selectDuration" id="selectDuration"> <option>3 days</option> <option>1 week</option> <option>2 weeks</option> <option>more then 2 weeks</option> </select> <br> <label for="selectAdult">Adults(13+)</label> <select name="selectAdult" id="selectAdult"> <option selected>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>more than 10</option> </select> <br> <label for="selectChild">Children up to 12: </label> <select name="selectChild" id="selectChild"> <option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>more than 10</option> </select> <br> <label for="selectInfant"> Infant up to 2 years: </label> <select name="selectInfant" id="selectInfant"> <option>0</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>more than 10</option> </select> <br> <label for="selectPrebook">Pre Book Seats: </label> <select name="selectPrebook" id="selectInfant"> <option>Yes</option> <option>No</option> </select> <br> <label for="selectLeg">Extra Leg Room Seats if Applicable: </label> <select name="selectLeg" id="selectLeg"> <option>Not Required</option> <option>Required</option> </select> <br> <label for="selectMeals"> Meals Required: </label> <select name="selectMeals" id="selectMeals"> <option>Not Required</option> <option>Required</option> </select> <br> <label for="selectParking"> Airport Car Parking: </label> <select name="selectParking" id="selectParking"> <option>On Airport</option> <option>Off Airport</option> </select> <br> <label for="selectVip"> VIP Lounge at Airport: </label> <select name="selectVip" id="selectVip"> <option>Not Required</option> <option>Required</option> </select> <br> <br> <label for="txtExtras">Medical Requirements::</label> <textarea name="txtExtras" cols="30" rows="5" id="txtExtras"></textarea> <br> <br> <label for="txtExtras">Other Requirements:</label> <textarea name="txtMedical" cols="30" rows="5" id="txtMedical"></textarea> <br> <input type="submit" name="Submit" value="Submit" class="btn"> <input type="hidden" name="MM_insert" value="flights"></form> [/code]any suggestions, it annoying me because i used to know how to do it.... Quote Link to comment https://forums.phpfreaks.com/topic/22122-form-fields/ Share on other sites More sharing options...
steveclondon Posted September 26, 2006 Share Posted September 26, 2006 If it is before you can submit it then you need Javascript. Have you forgoten what language you used. Quote Link to comment https://forums.phpfreaks.com/topic/22122-form-fields/#findComment-99023 Share on other sites More sharing options...
Ninjakreborn Posted September 26, 2006 Share Posted September 26, 2006 He probably means how to validate with dreamweaver because <input type="hidden" name="MM_insert" value="flights">The MM before something means Macro Media, You can tell one from a mile away by the big MM before it. This is probably a form created by dreamweaver, I don't know how to validate using dreamweaver, you can just program it yourself like[code]<?php $errorhandler = "";if ($variable == "") {$errorhandler .= "The variable name was left blank please fix this.<br />";}if ($variable2 == "")$errorhandler .= "The variable2 name was left blank please fix this.<br />";}if ($errorhandler != "") {echo "<div style=\"color:red;\">";echo $errorhandler;echo "</div>";}?>[/code]this is something basic you can just build onto it from there, if you need more help ask. Quote Link to comment https://forums.phpfreaks.com/topic/22122-form-fields/#findComment-99030 Share on other sites More sharing options...
bladechob Posted September 27, 2006 Share Posted September 27, 2006 If you mean that it is a required field then it should look something like this $frm->requireField('forename'); $frm->requireField('surname'); $frm->requireField('address1'); Quote Link to comment https://forums.phpfreaks.com/topic/22122-form-fields/#findComment-99565 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.