sending a form

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
pacho
-


Joined: 03 Aug 2003
Posts: 1

PostPosted: Thu Aug 14, 2003 1:32 am    Post subject: sending a form Reply with quote

Hi, im trying to learn PHP, but some tutorials i found won't work. I want to send a form and process the variables with a .PHP file. But i get the error "variable undefined" or something like that. This is the code, if anyone can tell me what im doing wrong i'll thank you.
Sorry my poor english.

Code:
FILE1.PHP
<html>
<body>

<form method="post" action="file2.php">
Socio :<input type="Text" name="nombre"><br>
<input type="Submit" name="enviar" value="Aceptar información">
</form>

</body>
</html>
--EOF--

FILE2.PHP
<?
echo $nombre;
?>
--EOF--


Pacho
Back to top View user's profile Send private message
os17fan
-


Joined: 21 Mar 2003
Posts: 531
Location: USA

PostPosted: Thu Aug 14, 2003 1:39 am    Post subject: Reply with quote

For one thing you setup the form wrong , its supposed to look like

<form action="your_file.php" method="post">

and one more thing you forgot to put , the file can not be processed without the post varible in your PHP area , put

Code:
echo $_POST["nombre"];


Here is a sample PHP Post script:

Name this: test.html
Code:
<form action="test.php" method="post">
<input type="text" name="test">
<input type="submit" value="Submit">
</form>


Name this test.php
Code:
<?php
echo $_POST["test"];
?>


View a live example of this PHP script
http://www.offspringvideos.com/live/

For the submit button you don't need to put name="" , if you need a contact webmaster script , i made one for you and for other users on the forum
http://www.offspringvideos.com/contact_webmaster.zip Instructions included
_________________
This web server is the best !
Back to top View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
eric
-


Joined: 14 Aug 2003
Posts: 8

PostPosted: Sat Aug 16, 2003 6:26 pm    Post subject: register_globals Reply with quote

Your code could actually worked if you had turned on something called register_globals in php.ini in <WINDOWS DIRECTORY>/system32/php.ini.

The variable in the receiver script would then have worked because the variable would be set. However, this feature, register_globals, got turned off since version 4.2.0 of PHP because a cracker could set variables this way in the URL: myphp.php?myVar=something in the variable.
Back to top View user's profile Send private message
os17fan
-


Joined: 21 Mar 2003
Posts: 531
Location: USA

PostPosted: Sat Aug 16, 2003 7:04 pm    Post subject: Reply with quote

My Register Globals is turned on , are you saying that my script is wrong or the script that the author of this post is wrong , im a NewB at PHP :oops:
_________________
This web server is the best !
Back to top View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
eric
-


Joined: 14 Aug 2003
Posts: 8

PostPosted: Sat Aug 16, 2003 9:29 pm    Post subject: not you Reply with quote

I was talking about the authors script :wink:
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group