Jump to content

value clause in input parameter


Guest charlied

Recommended Posts

Guest charlied

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

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

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

  • 5 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...