Jump to content


Photo

Form Fields


  • Please log in to reply
3 replies to this topic

#1 ltoto

ltoto
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 26 September 2006 - 03:36 PM

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:

<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>

any suggestions, it annoying me because i used to know how to do it....

#2 steveclondon

steveclondon
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts

Posted 26 September 2006 - 03:43 PM

If it is before you can submit it then you need Javascript. Have you forgoten what language you used.

#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 26 September 2006 - 03:53 PM

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
<?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>";
}
?>
this is something basic you can just build onto it from there, if you need more help ask.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#4 bladechob

bladechob
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts
  • LocationDerby, UK

Posted 27 September 2006 - 01:02 PM

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');
To forgive is to forget... to forget is... what was I saying?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users