FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Form Input variable





Dark-Tech
Code:
      echo "<form action=\"comment.php\" method=\"post\">
Enter your name: <input type=\"text\" name=\"name\" />
For this Image<input type=\"text\" name=\"Images1\"value=\"" . IMAGE . "\">
<br /></select><br />Enter your message: <input type=\"text\" name=\"message\" />
<input type=\"submit\" /></form>";   
    }


I can't figure out how to make it so when you hit submit it sends a variable without using an input box

For this Image<input type=\"text\" name=\"Images1\"value=\"" . IMAGE . "\">
i want that to be sent automatically without the user ever seeing it as something they can change
can someone tell me how to do that?
wumingsden
Code:
<input type=\"text\" name=\"Images1\"value=\"" . IMAGE . "\">


Hmm. Try this?:

Code:
<input type=\"hidden\" name=\"Images1\"value=\"" . IMAGE . "\">
Dark-Tech
Thanks that works
wumingsden
Dark-Tech wrote:
Thanks that works


Want me to leave this thread open in case you need more support?
fpwebs
OK. A really healthy habit you may want to get into is the following:

WHEN using HTML always pay attention to your ` " ' they will mean success or frustration!
When using HTML do the following example:
<input type='text' name='name' value=`value` />
BUT pay close attention to the VALUE! Instead of using " or ' it uses a `. That symbol is to the left of the 1/! or under the Escape key on a standard keyboard. It is more efficient to use single quotes (') in HTML especially when using PHP to not add any confusion. ONLY use ` symbol when using a VALUE. You can use <input type='hidden' name='username' value=`sally` /> to transfer information from one page to another. Just set up a variable on another page (or same page) that has: $username = $_POST['username'] or $_GET['username'] or even $_REQUEST['username'].

However, if you are planning on using GLOBAL information throughout your site (eg. using a username and password to get around the site) then I reccommend you using the $_COOKIE['cookiename']; variable. Set cookies for your site, but for security purposes try doing: $_COOKIE['YOURUSERNAME_username']. Also use the session function in PHP. They will come in handy. You can create or delete cookies at any time and are really simple to use. For more information you can go to:

http://www.w3schools.com/
phpc0d3r
Actually in html, It's not a good idea to use single quotes, Example:
Code:

<input type="text" name="something" />


instead of:

Code:

<input type='text' name='something' />



So in Your php file, you can use this code:

Code:

$string = '<input type="text" name="something" value="'.$var.'" />';


The sections single quotes won't get evaluated by the php engine.
fpwebs
it's the same thing, but only reversed lol. it wouldn't matter so long as there aren't much error.
Related topics
Mail with PHP (Simple Tutorial)
form button to open a custom sized new window
(official) Firefox & Thunderbird 1.5 Beta2 Now Available
Opera 9.0 Technology Preview 2
Please help with php-quick question
Why some script tags must put in the head of document?
HTML with mail()
E-mail me button help
Building Web Forms In Flash
Cheap form hosting
Application form - getting rid of ucwords
Application form - onSubmit='return false;
CSS DropDown w/Contact Form GabrielCastillo.net
Array Update SQL script not working
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.