This is what I want to happen:
if "one" is the text in the first text field, and the first button is clicked, post.php returns 1one
if "two" is the text in the second text field, and the second button is clicked, post.php returns 2two.
This is what happens right now:
the first button returns "2" regardless of what the input field is.
the second button works as I want
This is the code
designers.php
post.phpPHP Code:<?php
$result = mysql_query("SELECT * FROM designers");
$designercounter = 1;
while($row = mysql_fetch_array($result)){
$name ='designer'.$designercounter;
echo"<div id='header'><p>" . $row['designer_name'] . "</p></div>";
echo"<form action = 'post.php' method ='POST' >";
echo"<input type='submit' name='submit' value = 'Change name'>";
echo"<input type='text' name='designername' size='30' >";
echo"<input type='hidden' name='pasedvariable' value='".$designercounter."'> </form>";
$designercounter++ ;
}
?>
Any help or guidance would be appreciatedPHP Code:<?php
$designerid = $_POST['pasedvariable'];
$designername = $_POST['designername'];
echo $designerid;
echo $designername;
?>



Reply With Quote


Bookmarks