Jump to content

Simple echo...


prawn_86

Recommended Posts

Hi all,

 

Simple question, i just cant quite figure out where i need to put the line of code (Im new).

 

I want to echo to a page wqhen my users submit the form. Here is the PHP codes i have on my page. Where would i put the echo statement, for a page called process.html?

 

<?php
//process any requests they have sent
if (isset($_GET['submit']) && $_GET['submit'] == true){
$title = mysql_real_escape_string($_POST['title']);
$url = mysql_real_escape_string($_POST['url']);
$sql = "INSERT INTO `test_table` VALUES('', '$title', '$url');";
mysql_query($sql);

}
?>

 

<?php

$sql = "SELECT excluded_word FROM `word_exclusion_table`";
$result = mysql_query($sql);
$whereclause = "";
while ($row = mysql_fetch_assoc($result)){
$whereclause .= (($whereclause) ? ' AND ' : ' WHERE ')."title NOT LIKE '%".$row['excluded_word']."%' ";
$whereclause .= (($whereclause) ? ' AND ' : ' WHERE ')."url NOT LIKE '%".$row['excluded_word']."%' ";
}

//time to show you what you have in the database
$sql = "SELECT * FROM `test_table` $whereclause ORDER BY `id` DESC LIMIT 5000;";
$result = mysql_query($sql);
print "			<table border=\"0\">\n";
while ($row = mysql_fetch_assoc($result)){
$title = $row['title'];
$url = $row['url'];
	echo "				<tr>
				<td><a href=\"$url\" target=\"http://www.freefreeads.com\">$title</a></td>
			</tr>
";
}
print "			</table>\n";
?>

Link to comment
https://forums.phpfreaks.com/topic/149350-simple-echo/
Share on other sites

  • 2 weeks later...

 

 

what about this then.

 

<?php
while ($row = mysql_fetch_assoc($result)){
   $title = $row['title'];
   $url = $row['url'];
      echo "            <tr>
               <td><a href=\"{$_SERVER['PHP_SELF']}?cmd=go\">$title</a></td>
            </tr>
";
}
print "         </table>\n";


if(isset($_GET['cmd'])&& $_GET['cmd']=="go"){

header("location: where_ever.php");

exit;
}

?>

Link to comment
https://forums.phpfreaks.com/topic/149350-simple-echo/#findComment-796169
Share on other sites

<?php
while ($row = mysql_fetch_assoc($result)){
   $title = $row['title'];
   $url = $row['url'];
      echo "            <tr>
               <td><a href=\"{$_SERVER['PHP_SELF']}?cmd=go\">$title</a></td>
            </tr>
";
}
print "         </table>\n";


if(isset($_GET['cmd']) && $_GET['cmd']=="go"){
   
   header("location: where_ever.php");
   
   exit;
}

?>

 

Try that.

Link to comment
https://forums.phpfreaks.com/topic/149350-simple-echo/#findComment-796431
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.