For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > August 2005 > Please help a Newbie









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Please help a Newbie
Doug Jones

2005-08-18, 5:56 pm

I'm at beginning of the PHP learning curve.
Will someone out there help me with this problem.

On the client side the user fills in a form in HTML and submits
with:
<form NAME="Mail" METHOD=POST ACTION="phpemail.php">
snip
<input TYPE="submit" VALUE="Send">
then my PHP code on the server side is:
<?php
$Message = "Customer Name = ".$_REQUEST["Customer"];
$Message .= "\nCompany Name = ".$_REQUEST["Company"];
$Message .= "\nAddress 1 = ".$_REQUEST["Address1"];
$Message .= "\nAddress 2 = ".$_REQUEST["Address2"];
$Message .= "\nAddress 3 = ".$_REQUEST["Address3"];
$result = mail("myname@myisp.net", "Name And Address", $Message);
?>
This does what it should, but it also echos a screen to the client.
How do I stop or prevent the echo?

Thanks for any help

dougjones


Janwillem Borleffs

2005-08-18, 5:56 pm

Doug Jones wrote:
> This does what it should, but it also echos a screen to the client.
> How do I stop or prevent the echo?
>


Have a look at http://www.php.net/exit


JW



Stefan Rybacki

2005-08-18, 5:56 pm

Doug Jones wrote:
> I'm at beginning of the PHP learning curve.
> Will someone out there help me with this problem.
>
> On the client side the user fills in a form in HTML and submits
> with:
> <form NAME="Mail" METHOD=POST ACTION="phpemail.php">
> snip
> <input TYPE="submit" VALUE="Send">
> then my PHP code on the server side is:
> <?php
> $Message = "Customer Name = ".$_REQUEST["Customer"];
> $Message .= "\nCompany Name = ".$_REQUEST["Company"];
> $Message .= "\nAddress 1 = ".$_REQUEST["Address1"];
> $Message .= "\nAddress 2 = ".$_REQUEST["Address2"];
> $Message .= "\nAddress 3 = ".$_REQUEST["Address3"];
> $result = mail("myname@myisp.net", "Name And Address", $Message);
> ?>
> This does what it should, but it also echos a screen to the client.
> How do I stop or prevent the echo?


What do you mean by echos a screen? You mean you get a blank page?
If you don't want that but calling another page use the header function.

header("Location: http://www.foo.bar");

Regards
Stefan

>
> Thanks for any help
>
> dougjones
>
>

Doug Jones

2005-08-18, 5:56 pm


"Stefan Rybacki" <stefan.rybacki@gmx.net> wrote in message
news:3mkcovF16gqnmU1@individual.net...
> Doug Jones wrote:
>
> What do you mean by echos a screen? You mean you get a blank page?

Yes.[color=darkred]
> If you don't want that but calling another page use the header function.
>
> header("Location: http://www.foo.bar");
>
> Regards
> Stefan
>

Stefan Rybacki

2005-08-18, 5:56 pm

Doug Jones wrote:
>...


>
> Yes.


Ok. So you want to use the header function to redirect to another page.
I also recommend the global $_SERVER to construct the correct redirect address.

$_SERVER['SERVER_NAME'] and
$_SERVER['PHP_SELF']

can help you to get the current server and directory.

Further questions?

Regards
Stefan


>
>...
>
>

Doug Jones

2005-08-19, 4:13 pm


"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:4304fc76$0$88444$dbd49001@news.euronet.nl...
> Doug Jones wrote:
>
> Have a look at http://www.php.net/exit
>
>
> JW
>
>
>

I can't see the connection so to speak. No help at that link.

Thanks

DJ


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com