smower
asked on
Php Html Value List Pulled from Database only Http Posting the First Word
Hello,
I have a little php site that was created via a wizard that pulls data from a database. On the edit records page there is a value list of shipping carriers that are pulled from the database. A user can pick the shipping carrier. When they click the button to submit the updates, only the first word is posted. For example if the shipping carrier picked is "Old Dominion" - only "Old" is submitted. This appears to be the code in the php file that deals with this value list:
The following is the html code section created:
Thank you,
Shawn
I have a little php site that was created via a wizard that pulls data from a database. On the edit records page there is a value list of shipping carriers that are pulled from the database. A user can pick the shipping carrier. When they click the button to submit the updates, only the first word is posted. For example if the shipping carrier picked is "Old Dominion" - only "Old" is submitted. This appears to be the code in the php file that deals with this value list:
<td class="field_data">
<?php $fieldName = 'Ship Via';?>
<?php $fieldValue = $record->getField('Ship Via', 0) ; ?>
<select class="fieldinput" name="<?php echo getFieldFormName($fieldName, 0, $record, true, 'POPUPLIST', 'text');?>" id="shipvia">
<?php $menuOptions = getMenu($layout->getValueListTwoFields('Shipping Carriers', (isset($master_record))
? $master_record->getRecordId()
: $record->getRecordId()), $fieldValue, $fieldName, 'text', $submitDateOrder);
if ($fieldValue == "") {
$selected = "selected";
}
else {
$selected = "";
}
if (($cgi->get('menuSelectedFound') == false) && ($selected == "")) {
$menuOptions = "<option value='$fieldValue' selected>$fieldValue</option>".$menuOptions;
}
$menuOptions .= "<option value='' $selected></option>";
echo $menuOptions;
?>
</select>
</td>
The following is the html code section created:
<option value=AAA Cooper >AAA Cooper</option>
<option value=ABF >ABF</option>
<option value=ALG >ALG</option>
<option value=Canada Post >Canada Post</option>
<option value=Central Freight >Central Freight</option>
<option value=CH Robinson >CH Robinson</option>
<option value=Consolidated Freightways >Consolidated Freightways</option>
<option value=Conway >Conway</option>
<option value=CTII >CTII</option>
<option value=Custom Companies >Custom Companies</option>
<option value=Custom Company >Custom Company</option>
<option value=Dayton >Dayton</option>
<option value=Dayton Freight >Dayton Freight</option>
<option value=DHL >DHL</option>
<option value=Dohrn >Dohrn</option>
<option value=Dugan >Dugan</option>
<option value=Eagle >Eagle</option>
<option value=Echo >Echo</option>
<option value=Emery >Emery</option>
<option value=Estes >Estes</option>
<option value=Estes Express >Estes Express</option>
<option value=FEDERAL EXPRESS >FEDERAL EXPRESS</option>
<option value=FedEx selected>FedEx</option>
<option value=FedExpress >FedExpress</option>
<option value=Forward Air >Forward Air</option>
<option value=GI Trucking >GI Trucking</option>
<option value=Hercules >Hercules</option>
<option value=JP Express >JP Express</option>
<option value=Lee Jennings >Lee Jennings</option>
<option value=NEMF >NEMF</option>
<option value=Oak Harbor >Oak Harbor</option>
<option value=Old Dominion >Old Dominion</option>
<option value=Pilot Delivers >Pilot Delivers</option>
<option value=Pitt Ohio >Pitt Ohio</option>
<option value=Pitt Ohio Express >Pitt Ohio Express</option>
<option value=PJAX >PJAX</option>
<option value=Purolator >Purolator</option>
<option value=R&L >R&L</option>
<option value=Roadtex >Roadtex</option>
<option value=Roadway >Roadway</option>
<option value=Saia >Saia</option>
<option value=SEFL >SEFL</option>
<option value=SEKO >SEKO</option>
<option value=Southeastern Freight >Southeastern Freight</option>
<option value=Southwestern Motor >Southwestern Motor</option>
<option value=Sweeney Transportation >Sweeney Transportation</option>
<option value=Team World Wide >Team World Wide</option>
<option value=Unishippers >Unishippers</option>
<option value=UPS >UPS</option>
<option value=USF Holland >USF Holland</option>
<option value=USPS >USPS</option>
<option value=Vitran >Vitran</option>
<option value=Ward Trucking >Ward Trucking</option>
<option value=Wilson >Wilson</option>
<option value=Yellow Freight >Yellow Freight</option>
<option value=YRC >YRC</option>
<option value='' ></option>
I am assuming the problem is that the option values are not being place in quotes. Can you tell me how to update the html php code so that it places that option value in quotes if that is the solution?Thank you,
Shawn
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
But value='$fieldValue' does have single quotes which should be fine. But they are not showing up in your results. That's why I say that something else must be going on because the quotes are there in your code but not in your results.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That looks much more like it!
ASKER
That was the final code I changed to get it to work.
ASKER
$menuOptions = "<option value='$fieldValue' selected>$fieldValue</opti
Thank you, Shawn