IwnfuM Posted September 14, 2010 Share Posted September 14, 2010 Hi , how I can save something into form? I mean , insert something in variable and than insert it into value in the form so when i send the form the value will be send too. I also want that it will be can not change. for example : <input name="email" value="a@s.d"/> but this example can be change if you insert something else. thanks , Mor. Quote Link to comment Share on other sites More sharing options...
the182guy Posted September 14, 2010 Share Posted September 14, 2010 If you don't want the user to see the variable then use a HTML hidden input inside the form tag, the data will be sent with the form but the user won't see it like so: <input type="hidden" name="myvariable" value="182" /> Be aware that any form input can be changed (even hidden) if the user really wanted to, for example by using the Firebug extension of Firefox. Quote Link to comment Share on other sites More sharing options...
IwnfuM Posted September 14, 2010 Author Share Posted September 14, 2010 help me lot. thanks , Mor. Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 14, 2010 Share Posted September 14, 2010 Just be aware that it is possible for a user to view the source page of the form and send any data they like - even for hidden fields. So, always validate the sent data before using it. In this case since you are sending an email address I would suggest saving the email addresses to a database or creating an include file with an array defined with the email addresses. In the form page put the id of the email address. Then in the processing page use the ID to get the actual email address. You should never include an email address in a web page (visible or not) unless you want that page to be picked up by spam bots. Quote Link to comment Share on other sites More sharing options...
chersull_99 Posted September 14, 2010 Share Posted September 14, 2010 You can do this - and the hidden field's value will change based on whatever value you set for @formVariable. Is that what you mean? ------------------------ <?php $formVariable = "This Value"; ?> <form name="frmSample" action="frmSubmit.php" method="post"> <input type="hidden" name="hdnVariable" value="<?php print $formVariable; ?>"> <input type="submit"> </form> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.