Jump to content

html php form problem


pwesthead

Recommended Posts

I have a dropdown list in a html form, i get the info for the dropdown list from mysql database using php, the problem is when i choose a name from the drop downlist and echo the name out i only get half the name if there is a gap in the name, eg  if i get a name bart simpson it will only output  bart and not show the last name, its something to do with the space in the name.

 

here is the code.

<form action='<?php echo $_SERVER['PHP_SELF']?>' method=post>
	<select name='charity_name' id="charity_name">
	<option    <?php 
    //loop through categories table rows
    while ($row=mysql_fetch_array($charity)){
    echo "<option value=$row[charity_name]>$row[charity_name]"; 
    }
    ?></option>
	</select>
	
	<input type=submit value="Go">
</form>
          
 <? 
		
    $charity_name=$_POST['charity_name']; 
    
   
?>
<?php echo $charity_name;?>

thanks paul

Link to comment
https://forums.phpfreaks.com/topic/297466-html-php-form-problem/
Share on other sites

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.