Jump to content

php string variable in a html form value parameter ?


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,

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.