spires Posted March 2, 2009 Share Posted March 2, 2009 Hi Guys. I have a form that i'm trying to build. I need the form to generate a multi array. The form work fine, however, for some reason the results the are being echoed out seem to have an extra \n. Website: http://adwordssupremacy.com/bulkmailer_list.php Fill in the top box with: jeff, [email protected] tim, [email protected] james, [email protected] <?PHP if (isset($_POST['submit'])){ $vars = array( // Enter your Campaign and AdText details "list" => "", ); $vars['list'] = trim($_POST['list']); $list_explode = explode("\n", $vars['list']); $count_arr = count($list_explode); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Untitled Document</title> </head> <body> <center> <form name="form1" method="post" action="<?PHP $_SERVER['PHP_SELF']; ?>"> <table width="700" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC"> <tr> <td bgcolor="#FFFFCC" align="center"><br /> <table width="650" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="67" height="30" align="left" valign="top"><strong>List:</strong></td> <td width="583" height="30"><textarea name="list" cols="67" rows="10"><?PHP echo trim($vars['list']);?></textarea></td> </tr> <tr> <td height="30"> </td> <td height="30"><input name="submit" type="submit" value="Send Email" /></td> </tr> </table> <br /> <br /> </td> </tr> </table> </form> <br><br> <table width="700" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC"> <tr> <td bgcolor="#FFFFCC" align="center"><br /> <table width="650" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="68" height="30" align="left" valign="top"><strong>Results:</strong></td> <td width="582" height="30"><textarea name="list" cols="67" rows="10"><?PHP for ($row = 0; $row < $count_arr; $row++){ $list_explode2 = explode(', ', $list_explode[$row]); echo 'array( Name => "'.$list_explode2['0'].'", Email => "'.$list_explode2['1'].'"),' . "\n"; } ?></textarea></td> </tr> <tr> <td height="30"> </td> <td height="30"></td> </tr> </table> <br /> <br /> </td> </tr> </table> </center> </body> </html> Thanks for your help Link to comment https://forums.phpfreaks.com/topic/147649-help-with-form-please/ Share on other sites More sharing options...
samshel Posted March 2, 2009 Share Posted March 2, 2009 use trim to remove \n echo 'array( Name => "'.trim($list_explode2['0']).'", Email => "'.trim($list_explode2['1']).'"),' . "\n"; Link to comment https://forums.phpfreaks.com/topic/147649-help-with-form-please/#findComment-775108 Share on other sites More sharing options...
spires Posted March 2, 2009 Author Share Posted March 2, 2009 Thats perfect Thanks for your help Link to comment https://forums.phpfreaks.com/topic/147649-help-with-form-please/#findComment-775110 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.