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.

Recommended Answers

All 2 Replies

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" />
commented: useful post +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.