0

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>
    <br>
    Name:<?php echo $in_name; ?>
    </br>
    <br>
    Surname:<?php echo $in_surname ; ?>
    </br>
    <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.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by varoluscu_prens
2

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" />
Votes + Comments
useful post
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.