Display web page in php on click of submit Button
Posted: Wed Sep 26, 2007 5:59 am
feyd | Please use ----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Please help me to sort out this problem as eary as possible, i have to report to boss to the earnest regarding this work.
Thanx.........yours .........Atif
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi to all and sundry. I'm ,Atif a newbie to this forum
I've a question regarding php. if anyone could answer it i would be honoured.
thanx in advance.
---------------------------------------------------------------
I have a table in MYSQL named product.
Columns in product are named as pcode(product code ) and purl (product url).
i have to generate a search code such that,
if i enter the pcode in the search text for the corresponding purl,
the webpage corresponding to that url gets displayed as i click the submit
button.
I tried out my best ,in the end i was able to display the url only and not the web page corresponding to that url.
here is the code i tried:.
-------------------------------------------------------------------------
Productmanage.php
-----------------------------Code: Select all
<html>
<title>Product CMS: Search Products</title>
<body>
<h1>Manage Products</h1>
<?php
include "dbconnect.php";
// The basic SELECT statement
$select = 'SELECT DISTINCT pcode,purl ';
$from = ' FROM product';
$where = ' WHERE 1=1 ';
$searchtext = $_POST['searchtext'];
if ($searchtext != '')
{ // Some search text was specified
$where .= " AND pcode LIKE '%$searchtext%'";
}
?>
<table>
<tr> <th>Product url</th></tr>
<?php
$url = @mysql_query($select . $from . $where);
if (!$url)
{
echo '</table>';
exit('<p>Error retrieving urls from database!<br />'.
'Error: ' . mysql_error() . '</p>');
}
while ($pdurl = mysql_fetch_array($url))
{
echo "<tr valign='top'>\n";
$id = $pdurl['pcode'];
$purl = htmlspecialchars($pdurl['purl']);
//echo "<td>$id</td>\n";
echo "<td> <a href='link:$purl'>$purl</a>";
echo "</tr>\n";
}
?></table>
<p><a href="productsearch.html">New search</a></p>
</body>
</html>-----------------------------Productsearch.html
Code: Select all
<html>
<title>Joke CMS:URL Search </title>
<body>
<h3>Search Product URLs from Product Code</h3>
<form action= "productmanage.php" method="post">
<label>Containing ProductCode: <input type="text" name="searchtext" />
</label><br />
<input type="submit" value="Search" />
</form></body></html>Please help me to sort out this problem as eary as possible, i have to report to boss to the earnest regarding this work.
Thanx.........yours .........Atif
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]