Jump to content

Recommended Posts

I am trying to display another list menu when "Ready Made" is selected from prod_type through an if statement but nothing happens. I don't know what the error is, can some one help please.

 


<select name="prod_type" id="prod_type" style="padding:5px;">
    <option>Select Product Type</option>
    <option>Ready Made</option>
    <option>Unstiched</option>
    </select>

<?php 
if ($prod_type == 'Ready Made') {
	echo "<p>Size:</p>\n"; 
	echo "  <p>\n"; 
	echo "    <label>\n"; 
	echo "    <select name=\"prod_size\" id=\"prod_size\" style=\"padding:5px;\">\n"; 
	echo "      <option selected=\"selected\">Select Size</option>\n"; 
	echo "      <option>32</option>\n"; 
	echo "      <option>34</option>\n"; 
	echo "      <option>36</option>\n"; 
	echo "      <option>38</option>\n"; 
	echo "      <option>40</option>\n"; 
	echo "      <option>42</option>\n"; 
	echo "      <option>44</option>\n"; 
	echo "      <option>46</option>\n"; 
	echo "      <option>48</option>\n"; 
	echo "      <option>50</option>\n"; 
	echo "      <option>52</option>\n"; 
	echo "      <option>54</option>\n"; 
	echo "      <option>56</option>\n"; 
	echo "      <option>58</option>\n"; 
	echo "      <option>60</option>\n"; 
	echo "    </select>\n"; 
	echo "    </label>\n"; 
	echo "  <a href=\"#\" class=\"style7\">Check Size Chart </a></p>\n";
} else {
	echo "";
}
  ?>

Link to comment
https://forums.phpfreaks.com/topic/257243-php-if-statement/
Share on other sites

you're just wanting a new select option to show up right?

 

use JavaScript.. try this

 

<script type="text/javascript">
    var ele = document.getElementById("prod_type");
    var selected= ele.options[ele.selectedIndex].text;
    if(selected == "Ready Made"){
        document.getElementById('readyMadeSelect').innerHTML = "All the stuff you were trying to echo goes here";
   }
<script>

<select name="prod_type" id="prod_type" style="padding:5px;" onchange="updateReadyMade()">
    <option>Select Product Type</option>
    <option>Ready Made</option>
    <option>Unstiched</option>
</select>
<div id="readyMadeSelect"></div>

 

Link to comment
https://forums.phpfreaks.com/topic/257243-php-if-statement/#findComment-1318772
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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