• 0

Need help with a php form


Question

10 answers to this question

Recommended Posts

  • 0

I need help guys with a php form in which I am trying to create a drop down select list on "Product Interested In" but the only thing I see is the number 30, does anyone know what is going on?

Link of the page: http://www.ellsworthllc.com/beta/where_to_buy/index.php

Are you using PHP to generate the form? Looking a tthe source code. I see the <select> block there.. but it has inline CSS styling to not display it. also the number 30 that is displayed is out side of the <select> block so im not sure what you are doing behind the scenes to output that or why its getting outputted. Im assuming your PHP is generating this form. Must be an error in the logic. Without seeing the code cant say much.

Link to comment
Share on other sites

  • 0

Are you using PHP to generate the form? Looking a tthe source code. I see the <select> block there.. but it has inline CSS styling to not display it. also the number 30 that is displayed is out side of the <select> block so im not sure what you are doing behind the scenes to output that or why its getting outputted. Im assuming your PHP is generating this form. Must be an error in the logic. Without seeing the code cant say much.

Where did u found the "inline" css?

Link to comment
Share on other sites

  • 0

It's your js that is messing it up. Disable your browsers javascript and you will see that it loads correctly. I don't know js so all I can say is try removing each script that you have one by one until you find the culprit. Then work from there.

However. I think you have your some HTML problems as well.

&lt;label for="product"&gt;&lt;strong&gt;&lt;span class="blue"&gt;*&lt;/span&gt;Product interested in: &lt;/strong&gt;&lt;/label&gt;
&lt;select name="product" size="1" multiple="multiple" id="product" type="text"&gt;
     &lt;option&gt;5&lt;/option&gt;
     &lt;option&gt;10&lt;/option&gt;
     &lt;option&gt;20&lt;/option&gt;
     &lt;option&gt;30+&lt;/option&gt;
&lt;/select&gt;

Your current settings just gives a really undesirable drop down menu setup.

First off. You don't need type="text" here.

Next, if you want to allow multiple option selection, then you should really set the size to a number greater than 1 so that you can get the up and down arrows. If you only want to allow one selection in the menu like a normal drop down menu, then you need to remove multiple="multiple" and also size="1" would not be needed either.

Link to comment
Share on other sites

  • 0

Thanks Jordan but I am not either expert in JS, I know the basic like putting a form in a website but trying to figure it out what is going on with the JS, its going to be difficult for me. Anyone with JavaScript knowledge in here? I would appreciate it.

Link to comment
Share on other sites

  • 0

There is a problem with implementation of the nice forms script. They are using a markup combination of p's nested inside a div as a 'standin' for the select menu and javascript then sets the value of the select menu based on your selection. That standin in part is somehow mangled and it is stuck at the end of the page. If you notice there are some numbers towards the left bottom of the page. That is where your select menu is right now. The real select markup is set to display none.

Link to comment
Share on other sites

  • 0

There is a problem with implementation of the nice forms script. They are using a markup combination of p's nested inside a div as a 'standin' for the select menu and javascript then sets the value of the select menu based on your selection. That standin in part is somehow mangled and it is stuck at the end of the page. If you notice there are some numbers towards the left bottom of the page. That is where your select menu is right now. The real select markup is set to display none.

Thanks a lot, this is what are you talking about:

function replaceSelects() {
    for(var q = 0; q &lt; selects.length; q++) {
		//create and build div structure
		var selectArea = document.createElement('div');
		var left = document.createElement('div');
		var right = document.createElement('div');
		var center = document.createElement('div');
		var button = document.createElement('a');
		var text = document.createTextNode(selectText);
		center.id = "mySelectText"+q;
		var selectWidth = parseInt(selects[q].className.replace(/width_/g, ""));
		center.style.width = selectWidth - 10 + 'px';
		selectArea.style.width = selectWidth + selectRightSideWidth + selectLeftSideWidth + 'px';
		button.style.width = selectWidth + selectRightSideWidth + selectLeftSideWidth + 'px';
		button.style.marginLeft = - selectWidth - selectLeftSideWidth + 'px';
		button.href = "javascript:showOptions("+q+")";
		button.onkeydown = selectEvent;
		button.className = "selectButton"; //class used to check for mouseover
		selectArea.className = "selectArea";
		selectArea.id = "sarea"+q;
		left.className = "left";
		right.className = "right";
		center.className = "center";
		right.appendChild(button);
		center.appendChild(text);
		selectArea.appendChild(left);
		selectArea.appendChild(right);
		selectArea.appendChild(center);
		//hide the select field
        selects[q].style.display='none';
		//insert select div
		selects[q].parentNode.insertBefore(selectArea, selects[q]);
		//build &amp; place options div
		var optionsDiv = document.createElement('div');
		optionsDiv.style.width = selectWidth + 1 + 'px';
		optionsDiv.className = "optionsDivInvisible";
		optionsDiv.id = "optionsDiv"+q;
		optionsDiv.style.left = findPosX(selectArea) + 'px';
		optionsDiv.style.top = findPosY(selectArea) + selectAreaHeight - selectAreaOptionsOverlap + 'px';
		//get select's options and add to options div
		for(var w = 0; w &lt; selects[q].options.length; w++) {
			var optionHolder = document.createElement('p');
			var optionLink = document.createElement('a');
			var optionTxt = document.createTextNode(selects[q].options[w].text);
			optionLink.href = "javascript:showOptions("+q+"); selectMe('"+selects[q].id+"',"+w+","+q+");";
			optionLink.appendChild(optionTxt);
			optionHolder.appendChild(optionLink);
			optionsDiv.appendChild(optionHolder);
			//check for pre-selected items
			if(selects[q].options[w].selected) {selectMe(selects[q].id,w,q);}
		}
		//insert options div
		document.getElementsByTagName("body")[0].appendChild(optionsDiv);
	}
} 

Link to comment
Share on other sites

  • 0

I believe so. Wow it doesn't have to be this complex and long.

Well I downloaded that form, I didn't create it. Now can you tell me please what I need to fix under that code above?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.