PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
if (isset($_POST['form_submitted']))
{
echo $_POST['form_submitted'];
}
?>
<html>
<head></head>
<body>
<form action="<?php echo basename($_SERVER['SCRIPT_FILENAME']); ?>" method="post">
<input type="submit" name="form_submitted" value="Send this form now or you will melt into cheesy goodness" />
</form>
</body>
</html>
Try running it and see what it does. Of course, I could be totally misunderstanding your question, but using an include can be just as easily handled. include_page.php
<?php
include 'include_page.php';
?>
<html>
<head></head>
<body>
<form action="<?php echo basename($_SERVER['SCRIPT_FILENAME']); ?>" method="post">
<input type="submit" name="form_submitted" value="Send this form now or you will melt into cheesy goodness" />
</form>
</body>
</html>
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]
I knew that was going to happen. No one wants to read all that it is too hard to read and looks intimidating. Here's the first one that I am trying to fix without all the colors. OK I am trying it.
<?php
while ($row = mysql_fetch_array($result))
//other stuff up here that works fine. That pops up this form.
{
//this following form works fine too and sends to an email, when the email php is listed on a separate page. ( I include that under this so you can see it.) But when I try to include the email form within like this, it won't send to the email when the submit button is pushed.
$mailto = 'emailaddress@whatever.com';
echo "<form action='".$_SERVER['PHP_SELF']."' method='post'>
<input type='text' name='sendingfield' size=15>
<input type='submit' name='submit' value='submit' /></form>;
$another = $_POST['sendingfield']; //field that sends to email when submit is pushed'
$subject = 'Subject' for email;
$uself = 0;
$sep = (!isset( $uself ) ¦¦ ($uself == 0))? '\r\n' : '\n' ; //puts fields into email correctly.
$messageproper = 'Filled field listed in email field: $another\n';
mail($mailto, $subject, $messageproper, 'From:' . $sep . 'Reply-To:' . $sep); ";}}
//maybe I need an "if" echo down here if the submit button is pushed.
?>
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]
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]
I think I have what I need, maybe you guys can use this.
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]
Nicole wrote:Can you please explain to me about this
="<?php echo basename($_SERVER['SCRIPT_FILENAME']); ?>" It isn't liking it.
SCRIPT_FILENAME is a server variable. It is essentially the entire path and name of the currently in use file. Wrapping the basename() function around it gets just the page name you are on. It is more secure and more reliable than PHP_SELF.