php-general Digest 29 Oct 2011 23:47:26 -0000 Issue 7544

Topics (messages 315535 through 315544):

create file after form completion
        315535 by: Pau
        315536 by: Stephen
        315537 by: Ashley Sheridan
        315538 by: Pau
        315539 by: Ashley Sheridan
        315540 by: Tedd Sperling
        315541 by: Pau

What is an information_id  in directory
        315542 by: Ernie Kemp
        315543 by: Tim Streater
        315544 by: Ernie Kemp

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Dear all,

I am looking for information on how to have a file created after a
user has hit a submit on a registration form.

I want to use the variables typed in by the user to automatically
create a web page with those values.

In the registration form I have

$name = $HTTP_POST_VARS['name'];
$surname = $HTTP_POST_VARS['surname'];
$post = $HTTP_POST_VARS['post'];

and I would like to create an html document using those (and other) values:

<html>
  <head>
    <title>This is amazing Mr. $name</title>
  </head>
  <body>
    <p>My surname is $surname and my address $post</p>
  </body>
</html>

after the form has been completed.

I am a newbie to php and I have been trying to get that information
somewhere, but I was not successful.

A little help would be appreciated. In particular an example would be wonderful.

Thanks.

--- End Message ---
--- Begin Message ---
On 11-10-29 12:38 PM, Pau wrote:
Dear all,

I am looking for information on how to have a file created after a
user has hit a submit on a registration form.

This is a subject that will take a bit of your time to understand. This web site is a good place to start:

http://www.tizag.com/phpT/examples/formex.php

You need to create an HTML form in your web page.

The form specifies the PHP file that is the "form handler". When the user clicks submit, their web browser calls your file that is the form handler and passes to it the data that they entered.

Exactly what your form handler does is up to you. You can:

Respond to the user
Save the data in a file or database
Email the data

Good luck
Stephen

--- End Message ---
--- Begin Message ---
On Sat, 2011-10-29 at 18:38 +0200, Pau wrote:

> Dear all,
> 
> I am looking for information on how to have a file created after a
> user has hit a submit on a registration form.
> 
> I want to use the variables typed in by the user to automatically
> create a web page with those values.
> 
> In the registration form I have
> 
> $name = $HTTP_POST_VARS['name'];
> $surname = $HTTP_POST_VARS['surname'];
> $post = $HTTP_POST_VARS['post'];
> 
> and I would like to create an html document using those (and other) values:
> 
> <html>
>   <head>
>     <title>This is amazing Mr. $name</title>
>   </head>
>   <body>
>     <p>My surname is $surname and my address $post</p>
>   </body>
> </html>
> 
> after the form has been completed.
> 
> I am a newbie to php and I have been trying to get that information
> somewhere, but I was not successful.
> 
> A little help would be appreciated. In particular an example would be 
> wonderful.
> 
> Thanks.
> 


Instead of trying to actually create the file, why don't you pass those
values across dynamically? In-fact, one PHP script could do the whole
job:

<?php
if(isset($_POST['name']))
{
    $name = htmlspecialchars($_POST['name']);

    echo "Hello $name";
}
else
{
    // your form here
}

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hello,

thanks for your answers.

I do have a form already and I am using it to mail the results:

------------------------
<?php
//include
//<?php

$HTTP_POST_VARS = $_POST;

$time = date("G:i:s");
$ip = getenv('REMOTE_ADDR');


$vorname = $HTTP_POST_VARS['vorname'];
$nachname = $HTTP_POST_VARS['nachname'];
$post = $HTTP_POST_VARS['post'];




mail("exam...@example.com",
  "New registration", "
time:           $time
ip-adress:      $ip

<html>
 <head>
   <title>This is amazing Mr. $name</title>
 </head>
 <body>
   <p>My surname is $surname and my address $post</p>
 </body>
</html>

");

?>
-----------------------

Instead of this, I would like to dump the results into a file, ideally
with a random name, taken from e.g. $$ in a specific directory

Something like

results/2345.html

with 2345.html

<html>
 <head>
   <title>This is amazing Mr. Paul</title>
 </head>
 <body>
   <p>My surname is Smith and my address Example Street 34</p>
 </body>
</html>

But I have no idea of how to tell php to create a file with the values
from the user.

thanks!
On 29 October 2011 19:27, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:
>
> On Sat, 2011-10-29 at 18:38 +0200, Pau wrote:
>
> Dear all,
>
> I am looking for information on how to have a file created after a
> user has hit a submit on a registration form.
>
> I want to use the variables typed in by the user to automatically
> create a web page with those values.
>
> In the registration form I have
>
> $name = $HTTP_POST_VARS['name'];
> $surname = $HTTP_POST_VARS['surname'];
> $post = $HTTP_POST_VARS['post'];
>
> and I would like to create an html document using those (and other) values:
>
> <html>
>   <head>
>     <title>This is amazing Mr. $name</title>
>   </head>
>   <body>
>     <p>My surname is $surname and my address $post</p>
>   </body>
> </html>
>
> after the form has been completed.
>
> I am a newbie to php and I have been trying to get that information
> somewhere, but I was not successful.
>
> A little help would be appreciated. In particular an example would be 
> wonderful.
>
> Thanks.
>
>
> Instead of trying to actually create the file, why don't you pass those 
> values across dynamically? In-fact, one PHP script could do the whole job:
>
> <?php
> if(isset($_POST['name']))
> {
>     $name = htmlspecialchars($_POST['name']);
>
>     echo "Hello $name";
> }
> else
> {
>     // your form here
> }
>
> --
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

--- End Message ---
--- Begin Message ---
On Sat, 2011-10-29 at 19:52 +0200, Pau wrote:

> Hello,
> 
> thanks for your answers.
> 
> I do have a form already and I am using it to mail the results:
> 
> ------------------------
> <?php
> //include
> //<?php
> 
> $HTTP_POST_VARS = $_POST;
> 
> $time = date("G:i:s");
> $ip = getenv('REMOTE_ADDR');
> 
> 
> $vorname = $HTTP_POST_VARS['vorname'];
> $nachname = $HTTP_POST_VARS['nachname'];
> $post = $HTTP_POST_VARS['post'];
> 
> 
> 
> 
> mail("exam...@example.com",
>   "New registration", "
> time:           $time
> ip-adress:      $ip
> 
> <html>
>  <head>
>    <title>This is amazing Mr. $name</title>
>  </head>
>  <body>
>    <p>My surname is $surname and my address $post</p>
>  </body>
> </html>
> 
> ");
> 
> ?>
> -----------------------
> 
> Instead of this, I would like to dump the results into a file, ideally
> with a random name, taken from e.g. $$ in a specific directory
> 
> Something like
> 
> results/2345.html
> 
> with 2345.html
> 
> <html>
>  <head>
>    <title>This is amazing Mr. Paul</title>
>  </head>
>  <body>
>    <p>My surname is Smith and my address Example Street 34</p>
>  </body>
> </html>
> 
> But I have no idea of how to tell php to create a file with the values
> from the user.
> 
> thanks!
> On 29 October 2011 19:27, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:
> >
> > On Sat, 2011-10-29 at 18:38 +0200, Pau wrote:
> >
> > Dear all,
> >
> > I am looking for information on how to have a file created after a
> > user has hit a submit on a registration form.
> >
> > I want to use the variables typed in by the user to automatically
> > create a web page with those values.
> >
> > In the registration form I have
> >
> > $name = $HTTP_POST_VARS['name'];
> > $surname = $HTTP_POST_VARS['surname'];
> > $post = $HTTP_POST_VARS['post'];
> >
> > and I would like to create an html document using those (and other) values:
> >
> > <html>
> >   <head>
> >     <title>This is amazing Mr. $name</title>
> >   </head>
> >   <body>
> >     <p>My surname is $surname and my address $post</p>
> >   </body>
> > </html>
> >
> > after the form has been completed.
> >
> > I am a newbie to php and I have been trying to get that information
> > somewhere, but I was not successful.
> >
> > A little help would be appreciated. In particular an example would be 
> > wonderful.
> >
> > Thanks.
> >
> >
> > Instead of trying to actually create the file, why don't you pass those 
> > values across dynamically? In-fact, one PHP script could do the whole job:
> >
> > <?php
> > if(isset($_POST['name']))
> > {
> >     $name = htmlspecialchars($_POST['name']);
> >
> >     echo "Hello $name";
> > }
> > else
> > {
> >     // your form here
> > }
> >
> > --
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >


Please try not to top post.

To create a file, look into the fopen() function on php.net, which has
plenty of examples on how to create a file. Creating one with a new name
to avoid conflicts with other files on the system is a little more
tricky, but it's not too difficult.

What I asked in my earlier post though was whether you really need to
create a new HTML file from PHP or you just need to display the results
to the user?

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Oct 29, 2011, at 12:38 PM, Pau wrote:
> -snip-
> 
> I am a newbie to php and I have been trying to get that information
> somewhere, but I was not successful.
> 
> A little help would be appreciated. In particular an example would be 
> wonderful.
> 
> Thanks.

Pau:

<http://webbytedd.com/simple-stuff/post/index.php>

I leave the header and footer up to you.

Cheers,

tedd


_____________________
t...@sperling.com
http://sperling.com

--- End Message ---
--- Begin Message ---
Hi,

>
> Please try not to top post.

sorry, but I do not understand the expression (I am not native, as you
might have guessed). Do you mean not to include the email in my reply?
Sorry about that.

>
> To create a file, look into the fopen() function on php.net, which has plenty 
> of examples on how to create a file. Creating one with a new name to avoid 
> conflicts with other files on the system is a little more tricky, but it's 
> not too difficult.

I will look into that, thanks.

>
> What I asked in my earlier post though was whether you really need to create 
> a new HTML file from PHP or you just need to display the results to the user?
>

I really would like to create the file, if it is not too much trouble.
The user will not get to see the results until the file and contents
are checked.

thanks,

Pau

> --
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

--- End Message ---
--- Begin Message ---

2 - Make a new content area in Site Manager->Content Manager. It doesn't
matter what you put in your content area, you could just put "This is my new
content area" or "Hello World" if you so choose.

 

3 - Grab the information_id of the new content area you made. When you are
editing a content area that already exists, the information_id can be gotten
from the update page URL. 

 

I'm having trouble understanding this request:

 

1.     In item #2 the client wishes to put content here, I can only guess he
means a file with text in it. ?????

2.     Item #3 I know what an ID is but not in this context. I'm don't
understand what the client wishes here.??

 

 

Any help here would be appreciated.

 

../Ernie 

 

 

 


--- End Message ---
--- Begin Message ---
On 29 Oct 2011 at 20:46, Ernie Kemp <ernie.k...@sympatico.ca> wrote: 

> 2 - Make a new content area in Site Manager->Content Manager. It doesn't
> matter what you put in your content area, you could just put "This is my new
> content area" or "Hello World" if you so choose.
>
> 3 - Grab the information_id of the new content area you made. When you are
> editing a content area that already exists, the information_id can be gotten
> from the update page URL.
>
> I'm having trouble understanding this request:
>
> 1.     In item #2 the client wishes to put content here, I can only guess he
> means a file with text in it. ?????
>
> 2.     Item #3 I know what an ID is but not in this context. I'm don't
> understand what the client wishes here.??
>
> Any help here would be appreciated.

I think you posted an HTML-formatted email with images to this list. That is a 
waste of time (images are stripped). You'll need to send another email 
formatted as text-only. As it stands your mail made no sense at all.

--
Cheers  --  Tim

--- End Message ---
--- Begin Message ---
2 - Make a new content area in Site Manager->Content Manager. It doesn't
matter what you put in your content area, you could just put "This is my new
content area" or "Hello World" if you so choose.

3 - Grab the information_id of the new content area you made. When you are
editing a content area that already exists, the information_id can be gotten
from the update page URL. 

I'm having trouble understanding this request:

1. In item #2 the client wishes to put content here, I can only guess he
means a file with text in it. ?????
2. Item #3 I know what an ID is but not in this context. I'm don't
understand what the client wishes here.??


Any help here would be appreciated.

../Ernie 


--- End Message ---

Reply via email to