keepAway Posted May 11, 2011 Share Posted May 11, 2011 I have this code... <form method=post name=adauga_etapa> <table cellspacing=1 cellpadding=2 border=1 align=center> <tr><td align=center> .:: Gazde ::. </td> <td align=center> .:: Oaspeti ::. </td></tr> <tr><td> <select name="gazde"> <option value="0">#</option> <?php $luna=array(2 => "Timisoara", 3 => "Otelu", 4 => "Fc Vaslui", 5 => "Rapid", 6 => "Dinamo", 7 => "Steaua", 8 => "Gaz Metan", 9 => "CFR Cluj", 10 => "Targu Mures", 11 => "U Cluj", 12 => "Astra", 13 => "Brasov", 14 => "Pandurii Tg. Jiu", 15 => "Gloria Bistrita", 16 => "Craiova", 17 => "Urziceni" , 18 => "Victoria Branesti" , 19 => "Sportul"); foreach ($luna as $k => $v) echo "<option value=$v>$v</option>"; ?> </select> </td> <td> <select name="oaspeti"> <option value="0">#</option> <?php $luna=array(2 => "Timisoara", 3 => "Otelu", 4 => "Fc Vaslui", 5 => "Rapid", 6 => "Dinamo", 7 => "Steaua", 8 => "Gaz Metan", 9 => "CFR Cluj", 10 => "Targu Mures", 11 => "U Cluj", 12 => "Astra", 13 => "Brasov", 14 => "Pandurii Tg. Jiu", 15 => "Gloria Bistrita", 16 => "Craiova", 17 => "Urziceni" , 18 => "Victoria Branesti" , 19 => "Sportul"); foreach ($luna as $k => $v) echo "<option value=$v>$v</option>"; ?> </select> </td></tr> <tr><td colspan=2 align=center><input type=submit name=adauga value=Adauga /></td></tr> </table> </form> <?php if (isset($_POST['adauga'])) { echo $_POST['gazde']." - ".$_POST['oaspeti']; } ?> When i submit a string like (FC Vaslui, Gaz Metan or CFR Cluj ), a string created from two words it only appeat the first part of the word... What could i do that, when i pres submit button full sting should appear? Im at the very begining in this language and a little help will be apreciated .. thanks Link to comment https://forums.phpfreaks.com/topic/236114-have-this-code/ Share on other sites More sharing options...
Maq Posted May 11, 2011 Share Posted May 11, 2011 In the future, please place tags around your code. Link to comment https://forums.phpfreaks.com/topic/236114-have-this-code/#findComment-1213864 Share on other sites More sharing options...
fugix Posted May 11, 2011 Share Posted May 11, 2011 firstly, get into the habit of placing your attributes in double quotations, example these lines <form method=post name=adauga_etapa> <table cellspacing=1 cellpadding=2 border=1 align=center> should be <form method="post" name="adauga_etapa"> <table cellspacing="1" cellpadding="2" border="1" align="center"> this will help you to avoid errors in the future... also, can you show me an example of what this line echo $_POST['gazde']." - ".$_POST['oaspeti']; is echoing when the form is submitted with 2 word strings. Link to comment https://forums.phpfreaks.com/topic/236114-have-this-code/#findComment-1213865 Share on other sites More sharing options...
keepAway Posted May 11, 2011 Author Share Posted May 11, 2011 Link to comment https://forums.phpfreaks.com/topic/236114-have-this-code/#findComment-1213870 Share on other sites More sharing options...
PaulRyan Posted May 11, 2011 Share Posted May 11, 2011 Try the following code, I've add any double and signle quotes where necessary. <form method="POST" action="" name="adauga_etapa"> <table cellspacing="1" cellpadding="2" border="1" align="center"> <tr> <td align="center"> .:: Gazde ::. </td> <td align="center"> .:: Oaspeti ::. </td> </tr> <tr> <td> <select name="gazde"> <option value="0">#</option> <?php $luna=array(1 => "Timisoara", "Otelu", "Fc Vaslui", "Rapid", "Dinamo", "Steaua", "Gaz Metan", "CFR Cluj", "Targu Mures", "U Cluj", "Astra", "Brasov", "Pandurii Tg. Jiu", "Gloria Bistrita", "Craiova", "Urziceni", "Victoria Branesti", "Sportul"); foreach ($luna as $k => $v) { echo "<option value='$v'>$v</option>"; } ?> </select> </td> <td> <select name="oaspeti"> <option value="0">#</option> <?php foreach ($luna as $k => $v) { echo "<option value='$v'>$v</option>"; } ?> </select> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="adauga" value="Adauga" /></td> </tr> </table> </form> <?php if (isset($_POST['adauga'])) { echo $_POST['gazde']." - ".$_POST['oaspeti']; } ?> Try it out and tell me how it goes Regards, PaulRyan. Link to comment https://forums.phpfreaks.com/topic/236114-have-this-code/#findComment-1213872 Share on other sites More sharing options...
keepAway Posted May 11, 2011 Author Share Posted May 11, 2011 As it should, thanks guys Link to comment https://forums.phpfreaks.com/topic/236114-have-this-code/#findComment-1213875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.