Jump to content

[SOLVED] Drop down menu into database


yddib

Recommended Posts

<select name="relationship" id="relationship" >
<option value="Single" name="Single"<?php echo $row['relationship'] ==Single ? "selected=\"selected\"": "" ?>> Single </option>
<option value="InaRelationship" name="InaRelationship"<?php echo $row['relationship'] ==InaRelationship ? "selected=\"selected\"": "" ?>> In a Relationship </option>
<option value="Engaged" name="Engaged"<?php echo $row['relationship'] ==Engaged ? "selected=\"selected\"": "" ?>> Engaged </option>
<option value="Married" name="Married"<?php echo $row['relationship'] ==Married ? "selected=\"selected\"": "" ?>> Married </option>
<option value="Separated" name="Separated"<?php echo $row['relationship'] ==Separated ? "selected=\"selected\"": "" ?>> Separated </option>
<option value="Divorced" name="Divorced"<?php echo $row['relationship'] ==Divorced ? "selected=\"selected\"": "" ?>> Divorced </option>
</select>

 

This drop down menu successfully sends its values to the database but it won't send "In a Relationship" (i.e. with the spaces) Above I have the code that works with no spaces between those words.....how can I put spaces between it so that when I take it out of the database it isn't all one word?

Link to comment
https://forums.phpfreaks.com/topic/123589-solved-drop-down-menu-into-database/
Share on other sites

Change

<option value="InaRelationship" name="InaRelationship"<?php echo $row['relationship'] ==InaRelationship ? "selected=\"selected\"": "" ?>> code]
to
[code]<option value="In a Relationship" name="InaRelationship"<?php echo $row['relationship'] ==InaRelationship ? "selected=\"selected\"": "" ?>> 

[/code]

Archived

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

×
×
  • Create New...

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.