Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
A line of Code i need to change but need a bit of help
Old 02-04-2010, 12:19 PM A line of Code i need to change but need a bit of help
Junior Talker

Posts: 2
Trades: 0
Hi people,

I am new to PHP and slowly learning how it all works,

At the moment I am trying to edit a script.

The current code shows a checkbox and when ticketed it is set to work the process and so on and so fourth...
Code:
<td><input type='checkbox' name='AllowTip' value='yes' <?php ($this->options['AllowTip'] == true) echo "checked"; ?> /> Yes</td>
What I would like to do is change this code so you cannot see the checkbox and have it perminatly set to Yes.

I know this may sound basic but I would gratefully appreciate any help.

thanks.
bekk1n is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-04-2010, 12:31 PM Re: A line of Code i need to change but need a bit of help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
instead of the checkbox use

type="hidden" value="yes"
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-04-2010, 12:35 PM Re: A line of Code i need to change but need a bit of help
Junior Talker

Posts: 2
Trades: 0
lol of course. Thank you for the help, its truly appreciate
bekk1n is offline
Reply With Quote
View Public Profile
 
Old 02-04-2010, 12:37 PM Re: A line of Code i need to change but need a bit of help
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Edit: Chris beat me to it :P

What you are trying to do is kind of a hack, if the value is always yes then there is no need to use it at all. For example, these two blocks of code are equivalent if allowtip is always yes:
PHP Code:
if($_POST['AllowTip'] == 'yes')
{
     echo 
'foo';

PHP Code:
echo 'foo'
I realize however that it is probably much easier to just hard code this value into the HTML code, so what you can do is make it into a hidden field with a value of 'yes':

Code:
<input type="hidden" name="AllowTip" value="yes" />
Techincally, a user can still change the value of this field by modifying the source. If it is very important that this value be set to yes then I suggest you enforce it server side (in your PHP code).
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to A line of Code i need to change but need a bit of help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19252 seconds with 12 queries