jrjackson Posted April 17, 2009 Share Posted April 17, 2009 I'm using some code from Robert Planks php tutorials. But I'm having a hard time getting them to work together: I have a page called 'career.php' and it has this code at the top of the page: <?php $f = $_GET["f"]; if ($f) { setcookie("f", "", time()-3600); setcookie("f", $f, time()+3600*24*30); } else $f = $_COOKIE["f"]; if (!$f) $f = "Friend"; ?> If I put <?php echo $f; ?> in the career.php page and if I go to http://www.MYDOMAIN.com/career.php?f=Fred it writes their name in the page. So this part is working fine. 2nd PHP file I created is called "now-hiring.php" and I placed the following code in the php file: <?php // URL to redirect to $url = "http://www.MYDOMAIN.com/career.php"; if (isset($_GET["firstname"])) { $user = $_GET["firstname"] . "," . $_GET["state"] . "," . $_GET["email"]; // Filename to store the list of viewers $filename = "viewers.txt"; // Try to write to it @touch($filename); if (!is_writable($filename)) { die("Cannot write to $filename... please chmod it to 666."); } // Read the viewers file $viewers = array_map("trim", file($filename)); // Add this person to the list of viewers $viewers[] = $user; // Remove duplicates $viewers = array_unique($viewers); // Write back to the text file $fp = fopen($filename, "w"); fwrite($fp, implode("\n", $viewers)); fclose($fp); } // Redirect to the URL header("Location:$url"); die(); ?> The above php file simply writes the data; firstname, state and email to a text file named 'viewers.txt' - this is helpful in seeing who has opened my emails. My email program uses the following format for customizing outgoing emails: (!*FIRSTNAME*!) (!*STATE*!) (!*EMAIL*!) I'm trying to figure out what URL code I should be using in my email program. I have their data; firstname, state and email already. Here is what I thought the URL would look like that I email to people: http://www.MYDOMAIN.com/page.php?firstname={!firstname}&state={!state}&email={!email} The end result of all this code is to: 1] write the; firstname, state and email to the text file viewers.txt so I know has opened my emails. 2] echo their; firstname and state on my php page making the page seem customized for them. I hope this all makes sense to someone and that someone can help me. J.R. Quote Link to comment Share on other sites More sharing options...
jrjackson Posted April 17, 2009 Author Share Posted April 17, 2009 I only posted this a few minutes ago but I notice newer post have already received responses. Maybe what I need is more complex. Where can I go to get help with this? Thanks J.R. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 17, 2009 Share Posted April 17, 2009 Give us time to look at it. Don't bump so quickly. Other problems may get answers quicker because the answers just jump out... Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.