Forum Moderators: coopster
i am trying to figure out how to accomplish this...
i.e.
If a user selects from a drop down list menu, that a contact is a "real estate agent" then they must enter a value for "real estate agent name"....if they dont, an alert pops up, "you selected Real Estate Agent Lead Type, you must enter a Real Estate Agent Name"
if (isset($_POST['real_estate_agent']) && isset($_POST['agent_name'])) {
// form completed properly
}
else {
echo 'its not difficult...do it properly :)';
}
If you want to combine these then you need ajax, so you can have both the client and server side working together.
that is not my objective. i will try to clarify
The drop down menu list will have values of:
<select name"contact_type">
<option value"n/a" selected>N/A</option>
<option value"agent">Agent</option>
<option value"buyer">Buyer</option>
<option value"browsing">Just Browsing</option>
</select>
now, if they leave it as N/A, Buyer, or Just Browsing the form will process correctly.
IF they select Agent, i want to have the Agent Name field to have to be populated with a value
so im thinking it would have to be something like:
(this is not correct by any means, becuase im very new at PHP)
if{
field.contact_type == "agent"
then field.agent_name (must have a value)
}
This could be a solution:
<?php
if ($_POST['contact_type'] <> 'n/a' && $_POST['agent_type'] == '') {
echo 'Agent type can't be empty';
}