OK as a pHp novice, I ask for your patience. I realize I may be simplistic in my approach, but you have to start somewhere.
Ok, what I'm trying to do is present a form that a user will fill out. Then pass that data into a second form for verification. Then send that second form data to a query for insertion into a mysql DB.
I'll only reference a single input for time's sake.
Page 1
------------------
echo "<form action=\"admin.php?action=addaction\" method=\"post\" name=\"add\" id=\"add\">";
echo "<input type=\"text\" name=\"mnamei\" size=\"50\" maxlength=\"100\">";
echo "<input type=\"submit\" name=\"Submit\" value=\"Submit\">";
echo "<input type=\"reset\" name=\"Reset\" value=\"Reset\">";
echo "</form>";
------------------
Page 2
------------------
$mnameval = $_POST['mnamei'];
echo "<form action=\"admin.php?action=addaction2a\" method=\"post\" name=\"add\" id=\"add\">";
echo "<input type=\"text\" name=\"mname\" size=\"50\" maxlength=\"100\" value=\"$mnameval\">";
echo "<input type=\"submit\" name=\"Submit\" value=\"Submit\">";
echo "<input type=\"reset\" name=\"Reset\" value=\"Reset\">";
echo "</form>";
------------------
Page 3
------------------
$mnamevalf = $_POST['mname'];
echo = $mnamevalf;
-----------------
So my question is why doesn't this work? I need to solve this flow problem before I can address the insert.
Any ideas?
Passing variables through multiple pages then DB insert
Moderator: General Moderators
I'm passing the info via the url?action=. That way I can use the same page with includes.
Whats not working is that data does not seem to be passed from snippet 2 to 3. All I'm trying to do at this point is echo the value to the screen. Once I solve this data passing problem I can then send it to the insert instead of the echo.
Whats not working is that data does not seem to be passed from snippet 2 to 3. All I'm trying to do at this point is echo the value to the screen. Once I solve this data passing problem I can then send it to the insert instead of the echo.
omg, I'm really blind =]
May I suggest a slightly different approach? You can do something likeif not faster it is more readable this way
syntax error, should be echo $mnamevalf; without the equation sign.echo = $mnamevalf;
May I suggest a slightly different approach? You can do something like
Code: Select all
<?php
$mnameval = $_POST['mnamei'];
?>
<form action="admin.php?action=addaction2a" method="post" name="add" id="add">
<input type="text" name="mname" size="50" maxlength="100" value="<?php echo $mnameval; ?>">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form>
<?php
//other php-cod here
?>