I was wondering if it is possible to hold several e-mail pages in one PHP file and use PHP to determine which page to display based on a variable or hidden input on the parent page. This is what I've got so far:
This page shows a variation of that: http://www.infinitypages.com/research/divinclude.php. It basically sends a query string to the browser telling it which page to display. Could easily be modefied to just show certain parts of a page based on the query string.
I tried your suggestion, but I can't figure it out. I'm probably missing something obvious, but I just can't get it to work.
This is what I have so far:
PHP Code:
<?php
if ($_SERVER["QUERY_STRING"] == "")
{
$include = "email/mailapp.php";
}
else
{
$include = $_SERVER["QUERY_STRING"];
}
include("$include");
?>
<title>send stuff!</title>
<link rel="STYLESHEET" type="text/css" href="../popups/popup.css">
<font color=#F0F0F0>
<?php
$opinion = echo('
?>
<center>Hey, it's e-mail time!</center>
<br><br><br><br>
Which topic are you responding to?
<form action="mailthing.php" method="post">
<select name="subject">
<option value="response:society">Society
<option value="response:religion">Religion
</select>
<br><br>
Enter your opinions:
<br>
<textarea name="message" rows=10 cols=50></textarea>
<br><br>
<input type="submit" name="submit" value="I'm in for it, aren't I...">
<input type="hidden" name="mailto" value="brandon@radioactiverabbit.com">
</form>
<?
');
$comment = echo('
?>
<br><br>
<center>Tell me whatchu think!</center>
<br><br>
<form action="mailthing.php" method="post">
<textarea rows=10 cols=50>Any ideas? Suggestions? Send 'em to me!</textarea>
<br><br>
<input type="submit" name="submit" value="lemme hear it...">
<input type="hidden" name="subject" value="comments">
<input type="hidden" name="mailto" value="brandon@radioactiverabbit.com">
</form>
<?
');
$random = echo('
?>
<br><br>
<center>Randomness!</center>
<br><br>
Got a funny or bizarre quote? A strange story? An annoying habit of submitting stuff whenever you get the opportunity? Your search is over! Send it to me!
<br><br>
<form action="mailthing.php" method="post">
<textarea rows=10 cols=50>Tell me, tell me, tell me!</textarea>
<br><br>
<input type="submit" name="submit" value="well...">
<input type="hidden" name="subject" value="random">
<input type="hidden" name="mailto" value="brandon@radioactiverabbit.com">
</form>
<?
');
$mailapp = echo('
?>
<br><br>
<center>EMAIL APP</center>
<br><br>
<form action="mailthing.php" method="post">
<center>
To:<input type="text" name="mailto" length=15>
<br>
Subject:<input type="text" name="subject" length=10>
<br>
Message:<textarea rows=10 cols=50></textarea>
<br><br>
<input type="submit" name="submit" value="SEND EMAIL">
<br><br>
</form>
<?
');
}
?>
Ok, how about we use your original code? Shouldn't be too hard to get working. Just tell me when/under what circumstances the certain parts of the pages should be displayed, and I'll show you how to do it.
Ok, I think maybe I know what you're trying to do... The main problem with your code is the echo statements. When you are moving in and out of PHP like you are, you don't use echo. The only other thing I changed was the way it calls the variables. I wrote it so it will work when global variables are turned off.
<?
switch($_GET["p"]){
case "comment":
echo "Comment stuff";
echo "more comment stuff";
?> or you can do this <?
break;
case "other":
echo "other stuff";
echo "more stuff";
break;
default:
echo "oops, not a valid option";
}
?>
Bookmarks