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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.