954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

post problem in php file

Hi there;
I've received a irritant problem in my php code. Here is "index.html":

There are some javascript functions defined in the "head" tag.

<form autocomplete="off" action="result.php" method="post">
		<p>
			<label>Name:</label>
			<input type="text" id="name" />

		</p>
		<p>
			<label>Nachname: </label>
			<input type="text" id="surname" />
		
		</p>
		<p>
			<label>Abteilung</label>
			<input type="text" id="department" />
		</p>
		
		<input type="submit" value="Abfrage" />
	</form>


Here is the content of the "result.php":

<body>
    
    <?php 
    
    $in_name = $_POST["name"]; 
    $in_surname = $_POST["surname"];
    $in_department = $_POST["department"];
    
    ?>   
    
    <p>Incoming values: </p>
    
    Name:<?php echo $in_name; ?>
    </br>
    
    Surname:<?php echo $in_surname ; ?>
    </br>
    
    Department:<?php echo $in_department; ?>
    </br>

</body>


The values I've entered in the "index.html" do not appear in result.php. Redirection is working ,but name or surname do not appear.

How can I overcome that? Any help is greatly appreciated.

varoluscu_prens
Light Poster
25 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

Input fields need to have the attribute name specified, and this is then used as the key for the $_POST array. E.g.

<input type="text" id="name" name="name" />
blocblue
Posting Pro in Training
475 posts since Jan 2008
Reputation Points: 142
Solved Threads: 79
 

Thank you very much indeed.

varoluscu_prens
Light Poster
25 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: