I am posting full name value like i select Asad Khan from list menu and select another full name from other list menu when i am submitting this form its only show me the first part of Full Name like Asad not khan and same from other list menu. Now i want to post Full name how to do this?
I always find source code helps diagnose these kind of things. Can you post your form values and you might want to put something like this on the page that receives the POST data:
echo '<pre>'.print_r($_POST, TRUE).'</pre>';
Worth doing, just to ensure that you are receiving the data that you expect. Alternatively:
var_dump($_POST)
Post the code and your results and let’s take a look-see
its not working…same old result. I am selecting Full Name Civil Engineer from list menu and selecting Contraction Labor from another list menu when I am submitting the form I am posting the value through $_POST Array. but when i retrieve the data it show me only the first part “Civil” not showing “Engineer”. when i remove the space between Civil Engineer like Civil Engineer then its show me but with space it can not do. i want to retrieve the full with space.
As I said, post the full HTML of your form on here in [ CODE ] tags so we can see it. View Source, select from <form> to </form>, copy, paste, let’s take a look.
I know what the problem is: You don’t know the difference between HTML and PHP
Can you get the HTML code from the form and post that on here?
$fieldProfTotal = $_POST['fieldProf'];
$fieldValueTotal=$_POST['fieldValue'];
$fieldCount = count($fieldProfTotal);
$fieldCount2 = count($fieldValueTotal);
$prof = 0;
while($prof<$fieldCount)
{
echo $fieldProf =$fieldProfTotal[$prof];
$fieldValue=$fieldValueTotal[$prof];
mysql_query("INSERT INTO `visaprofessions` (`visaNumber`,`profession`,`noVisa`) VALUES ('$visaNumber','$fieldProf','$fieldValue')");
$prof++;
}
<form id="form1" name="form1" method="post" action="mainsearch.php">
<select name="fieldProf[]">
<option value="Civil Engineer">Civil Engineer</option>
</select>
</form>
OK, that’s HTML, but it’s still only one select box with one option. Apart from the fact that there’s no submit button I don’t see anything wrong with that.
Thanks Antnee for help. I have solved my problem actually the problem is in list menu. Thank you very much.
Thought it would be, hence why I wanted to see the HTML