Processing Forms variablesin

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!

Moderator: General Moderators

Post Reply
hmsg
Forum Commoner
Posts: 42
Joined: Sun May 14, 2006 9:48 am

Processing Forms variablesin

Post by hmsg »

feyd | Please use

Code: Select all

,

Code: Select all

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]


Hello!

    I'm trying to process a form with PHP, but i'm having problems on passing the values of different box i have in my form. I supposed that i'm creating form correctly   

      Here is the form i created:

[syntax="html"]<form action="iprodutos_.php" method="POST">
	Nome: <!--webbot bot="Validation" B-Value-Required="TRUE" --><input type="text" name="nome"><br><br>
	Descrição: <textarea rows="3" name="descricao" cols="26"></textarea><br><br>
	Categoria:<!--webbot bot="Validation" B-Value-Required="TRUE" B-Disallow-First-Item="TRUE" -->
	<select size="1" name="categoria">
	<option selected value="0">Seleccione ..</option>
	<option value="1">Colares</option>
	<option value="2">Brincos</option>
	<option value="3">Porta-Chaves</option>
	<option value="4">Pulseiras</option>
	<option value="5">Pinturas em Tecidos</option>
	<option value="6">Pinturas em Vidro e Gesso</option>
	<option value="7">Quadros</option>
	</select><br><br>
	Preço:<!--webbot bot="Validation" S-Data-Type="Number" S-Number-Separators="x," --><input type="text" name="preco" size="20"><br><br>
	Imagem: <input type="file" name="imagem" size="40"><br><br>
	<input type="submit" value="Submeter" name="enviar"><input type="reset" value="Repor" name="limpar">
</form>

Now in the script iprodutos_.php i need to receive the information in $nome, $descricao,$categoria,$preco,$imagem, but i don't know how. Is there a difference to receive a string or a integer or a decimal? Because $nome,$descricao and $imagem are a string, but $categoria is a integer, and $preco is a decimal number.

Can anyone help me with the code to receive this variables in iprodutos_.php? What code do i put in it?


With the best regards

Hugo Gomes


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

forms fields are submitted as strings to php. In your code, $_POST would contain all the posted data except for the file field, which is stored into $_FILES.
hmsg
Forum Commoner
Posts: 42
Joined: Sun May 14, 2006 9:48 am

But how

Post by hmsg »

Ok.

$_POST have the data from all fields except the last one that is the path of a file that is in $_FILES. But how i work with this variabels ($_POST and $_FILES)?

i work with them like $_POST? i need to assigned the value like $_POST = $_GET['POST'] ? i very new in php and maybe this is a stupid question, but for me it makes sense :D

I don't know how to received the values that i know now is in $_POST and work with them just like the $_FILES either.

Would you help me ?


With the best regards

Hugo Gomes
Post Reply