Current location: Hot Scripts Forums » Programming Languages » PHP » Cant find an error in my code


Cant find an error in my code

Reply
  #1 (permalink)  
Old 02-04-04, 12:20 PM
KoolAsIce KoolAsIce is offline
New Member
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Cant find an error in my code

I tryed 4 ages and cant seem to find anything wrong w/ this snippet of code... its for a forum poll script...

$option = 1;
$optionlist = while($option <= $_REQUEST[numofoptions])
{
echo("<tr><td><p><b>Poll: $_REQUEST[polloption$option] <input type=\"radio\" name=\"polloption\" value=\"$option\" /></b></p></td></tr>");
$option = $option +1;
};

can u help!??!?!
Reply With Quote
  #2 (permalink)  
Old 02-04-04, 01:51 PM
KeithMcL KeithMcL is offline
Newbie Coder
 
Join Date: Jul 2003
Location: Dublin, Ireland
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Does it produce an error message?

Try ommitting the '$optionlist = ' part.

PHP Code:

$option 1;
while ( 
$option <= $_REQUEST[numofoptions] ) {
echo(
"<tr><td><p><b>Poll: $_REQUEST[polloption$option] <input type=\"radio\" name=\"polloption\" value=\"$option\" /></b></p></td></tr>");
$option++;
}; 
Reply With Quote
  #3 (permalink)  
Old 02-04-04, 05:37 PM
fawaz4web fawaz4web is offline
New Member
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question

where is the error message?

write it
Reply With Quote
  #4 (permalink)  
Old 02-04-04, 05:49 PM
fawaz4web fawaz4web is offline
New Member
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
tri this code

Now it is correct

PHP Code:

 $option 1;

while(
$option <= $numofoptions)
{
echo(
"<tr><td><p><b>Poll: ".$polloption.$option."<input type=\"radio\" name=\"polloption\" value=\"$option\" /></b></p></td></tr>");
$option $option +1;
}; 
Reply With Quote
  #5 (permalink)  
Old 02-05-04, 10:21 AM
KoolAsIce KoolAsIce is offline
New Member
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
There is no error message... just a blank page, ill check the code youve given me and tell u what happens
Reply With Quote
  #6 (permalink)  
Old 02-06-04, 11:09 AM
fawaz4web fawaz4web is offline
New Member
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Wink

what happens with you ?

i'm sure it is coorrect
Reply With Quote
  #7 (permalink)  
Old 02-07-04, 09:14 PM
XxXoldsaltXxX XxXoldsaltXxX is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Try taking out the ';' you have on the last line.. thats not supposed to be there.
Reply With Quote
  #8 (permalink)  
Old 02-09-04, 09:24 PM
XxXoldsaltXxX XxXoldsaltXxX is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Aha! Jackpot :P

replace
PHP Code:

echo("<tr><td><p><b>Poll: $_REQUEST[polloption$option] <input type=\"radio\" name=\"polloption\" value=\"$option\" /></b></p></td></tr>"); 

with

PHP Code:

echo("<tr><td><p><b>Poll: ".$_REQUEST[polloption$option]." <input type=\"radio\" name=\"polloption\" value=\"".$option."\" /></b></p></td></tr>"); 

Reply With Quote
  #9 (permalink)  
Old 02-10-04, 02:46 AM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

How about this?

PHP Code:

echo("<tr><td><p><b>Poll: ".$_REQUEST['polloption'.$option]." <input type=\"radio\" name=\"polloption\" value=\"".$option."\" /></b></p></td></tr>"); 

__________________
Blavv =|
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP code to edit a text file mdhall Script Requests 12 12-23-10 04:03 AM
how to find control in placeholder nnet ASP.NET 0 01-13-04 11:44 PM
protecting code in PHP ckb PHP 12 01-02-04 08:53 AM
incorrect code, plz show me real code darkcarnival PHP 4 11-21-03 02:40 PM
perl/cgi newbie. hangman.cgi script adding html-like code on web and other trouble Arowana Perl 12 11-13-03 02:24 PM


All times are GMT -5. The time now is 08:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.