Jump to content

php string variable in a html form value parameter ?


Frank74

Recommended Posts

Hi :)

 

I struggle with something i'm trying to achieve. Maybe this is not the correct approach, i don't know.

 

My goal is to attribute a string of a field of the form to a string variable in order to use this string variable in order to "auto fill" the field of the form previously completed.

This is to do what is apparently called a sticky form...

 

First the program attributes the string of a field of the form to a string variable :

$EmitterFirstName = $_POST["EmitterFirstName"];

 

Then in the html form there is a field called "EmitterFirstName", and i want to use the string variable $EmitterFirstName in order to auto fill the field with the string previously typed by the user :

<input type="text" name="EmitterFirstName" value="<?php $EmitterFirstName ?>"/>

 

But it doesn't work as expected. Do you have any idea why or maybe an advice on how to code such a thing ?

 

Thanks,

Thanks for the answer russthebarber.

 

It seems to work with a text form :

<input type="text" name="EmitterFirstName" value="<?php echo $EmitterFirstName ?>"/>

 

But it doesn't seem to work with a textarea form :

<textarea cols="50" rows="6" name="EmitterMessage" value="<?php echo $EmitterMessage ?>">

 

The form appears empty even if the string variable $EmitterMessage contains a string.

 

Do you have an idea on how to make this work correctly ?

 

Thanks,

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.