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 cool

Notice there should be space between URL and kewword like in the above output.

Can anyone create this please?

Thanks

Recommended Answers

All 2 Replies

I have made a code...
Try this.
Hope this is what you want.

<!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>
<? if(isset($_REQUEST['submit']))
{
	$col1 = $_REQUEST['col1'];
	$col2 = $_REQUEST['col2'];
	$col3 = $_REQUEST['col3'];
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
	<td><?=$col1[0]?> <?=$col1[1]?></td>
</tr>
<tr>
	<td><?=$col2[0]?> <?=$col2[1]?></td>
</tr>
<tr>
	<td><?=$col3[0]?> <?=$col3[1]?></td>
</tr>

</table>
<? } else { ?>
<form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td>Column 1</td>
		<td>Column 2</td>
		<td>Column 3</td>
	</tr>
	<tr>
		<td><input type="text" name="col1[]" /></td>
		<td><input type="text" name="col2[]" /></td>
		<td><input type="text" name="col3[]" /></td>
	</tr>	
	<tr>
		<td><input type="text" name="col1[]" /></td>
		<td><input type="text" name="col2[]" /></td>
		<td><input type="text" name="col3[]" /></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><input name="submit" type="submit" /></td>
		<td>&nbsp;</td>
	</tr>
</table>
</form>
<? } ?>

</body>
</html>
Member Avatar for rajarajan2017

The below shows the exact output

<html>
<head></head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<?php 
	process();
?>
<input type="submit" name="submit" value="Commit">
</form>
</body>
</html>
<?php
$rows = 3;
$columns = 2;
$i = 0;
if (isset($_POST['submit'])) {
	echo "<table cellspacing = '5' cellpadding = '0'>";
    for ($r = 1; $r <= $rows; $r++) {
        echo "<tr>";
        for ($c = 1; $c <= $columns; $c++) {
			$i++;
            echo "<td>&nbsp;";
			echo $_POST['inp'.$i];
			echo "</td> ";
        }     echo "</tr> ";
    }
    echo "</table> ";
}
?>
<?php
function process() {
	$rows = 3;
	$columns = 2;
	$i = 0;
    echo "<table border = '1' width='30%' cellspacing = '5' cellpadding = '0'>";
    for ($r = 1; $r <= $rows; $r++) {
        echo "<tr>";
        for ($c = 1; $c <= $columns; $c++) {
			$i++;
			echo "<td>";
            echo "<input type=\"text\" name=\"inp$i\">";
			echo "</td>";
        } 
		echo "</tr> ";
    }
    echo "</table> ";
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.