Guest charlied Posted July 5, 2006 Share Posted July 5, 2006 I have a HTML form. I have several <input type="text"> lines. After the user enters a value in one of these input boxes, I would like the input to remain in the box. I would like to keep the same form/file to be used as input and output. I am using PHP as the scripting language. I am new to this as well. My input clause looks like this:<input type="text" name="Name1" size="11" maxlength="11" value="<?=$name?>">I can initialize it by setting it like this in front of the form:<?PHP if ( ! isset ($_POST['submit'])) { $name = ""; }?>After I enter a piece of data such as: jdoe I then do this:<?PHP if ( isset($_POST['submit'])) { $name = $_POST['Name1']; }?>The $name never remains set in the window. The field gets spaced out. Do I need to send a new form out?Thanks... Link to comment Share on other sites More sharing options...
justsomeguy Posted July 5, 2006 Share Posted July 5, 2006 I guess there are two things to look at. Either $_POST['submit'] is not set, or <?=$name?> is not outputting the name. Try using long tags instead, but I doubt that's the problem:<?php=$name?>You can also look in the PHP forum for a thread I made on how to do single-page form processing, and it shows an example in there as well. Link to comment Share on other sites More sharing options...
scott100 Posted July 5, 2006 Share Posted July 5, 2006 Try this, just inputing the value directly from the post contained in squiggly brackets <?phpprint " <input type=\"text\" name=\"Name1\" size=\"11\" maxlength=\"11\" value=\"{$_POST['Name1']}\"> ";?> Link to comment Share on other sites More sharing options...
cpugeek Posted August 4, 2006 Share Posted August 4, 2006 -hello Link to comment Share on other sites More sharing options...
aspnetguy Posted August 4, 2006 Share Posted August 4, 2006 please do not make posts like this...there is no need to repeat what someone has already said. Posts should add value to the thread. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now