Jump to content

Archived

This topic is now archived and is closed to further replies.

ltoto

Form Fields

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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');

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.