Hi I need to create small php script which do the follows but I am unsucessful. It works like this: When we run php script then it opens a page with 2 columns where we can enter information and there is also a submit button. I want that in first column I paste different URls one per line like: http://www.sitea.com/mypage.html http://www.domainb.com/page.html http://www.domainc.com/page2.html And in second column I paste keywords one per line eg: He is good I am here Steven is going And when I hit submit button Then it creates output on next page like: http://www.site.com/mypage.html He is good http://www.domainb.com/page.html I am here http://www.domainc.com/page2.html Steven is going Notice there should be space between URL and kewword like in the above output. Can anyone create this please? Thanks
You are going to need to do some validation on the data.... make sure its a URL, make sure theres some text, clean any bad characters, and so on, but typically something like this will do what you are after..... $urls = explode("\n", $_POST['box1']); $text = explode("\n", $_POST['box2']); if(sizeof($urls) != sizeof($text)) die ("number of urls and text isnt the same\m"); for($x=0; $x<=sizeof($urls)-1; $x++) { print $urls[$x]." ".$text[$x]."\n"; } PHP:
I know you've already finished this. I just thought the W3C TryIt editor is a great example of the two column layout you're talking about. Here's a modified version to suite your needs: <html> <head> <style type="text/css"> body { color:#000000; background-color:#ffffff; margin:4px; margin-top:0px; } .maintable { width:100%; background-color:#e5eecc; color:#000000; border:solid #c3c3c3 1px; margin-left:0px; } .code_input, .result_output { border:1px solid #c3c3c3; width:100%; height:400px; background-color:#ffffff; color:#000000; } .toptext { color:#617f10; font-family:verdana; margin-top:0px; margin-bottom:8px; font-size:120%; } .result_header { color:#617f10; margin-bottom:12px; margin-top:0px; font-family:verdana; font-size:90%; } .bottomtext_div { margin-right:3px; } .bottomtext { color:#617f10; font-family:verdana; margin-bottom:0px; margin-top:6px; font-size:90%; } </style> </head> <body> <form target="view" method="post" action="#" style="margin: 0px;"> <table cellspacing="3px" cellpadding="3px" border="0" class="maintable"> <tbody> <tr> <td width="50%"> <p class="result_header">Website Addresses:</p> <textarea ocols="42" orows="21" wrap="logical" name="code" height="400px" width="100%" class="code_input">http://www.someURL.co.uk/</textarea> </td> <td width="50%"> <p class="result_header">Associated Text:</p> <textarea ocols="42" orows="21" wrap="logical" name="code" height="400px" width="100%" class="code_input">some text</textarea> </td> </tr> <tr> <td align="left" class="bottomtext"> Edit the text above and click Save to see the result </td> <td align="right" class="bottomtext"> <input type="submit" style="margin-bottom: 5px; font-family: verdana;" name="submit" value="Save >>"> </td> </tr> </tbody> </table> </form> </body> </html> HTML: