Current location: Hot Scripts Forums » Programming Languages » PHP » Need Help


Need Help

Reply
  #1 (permalink)  
Old 03-06-06, 08:13 PM
klaniak klaniak is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Underground
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Need Help

What I want is to know how to check a checkbox with cURL
All I can do in with post is using the name and value, but the checkbox remains unchecked.
TOS is the name of checkbox and 1 is the value. If I use that but nothing happens.
EX of params:
$params='&blabla=blabla&TOS=1';

&TOS=1

<input name="TOS" type="checkbox" id="TOS" value="1">

How should I fix this problem ?
Reply With Quote
  #2 (permalink)  
Old 03-06-06, 08:26 PM
jordie jordie is offline
Wannabe Coder
 
Join Date: Jun 2005
Posts: 179
Thanks: 0
Thanked 0 Times in 0 Posts
you could do
PHP Code:

<?php

echo '<input name="TOS" type="checkbox" id="TOS" value="1"';
if(
$_GET['TOS'] == 1){
    echo 
' checked';
}
echo 
'>';
?>
__________________
Jordie Bodlay
php, mysql, postgres
css, xhtml
graphics, design
email me: jb2386@hotmail.com for any programming needs.
Reply With Quote
  #3 (permalink)  
Old 03-06-06, 08:49 PM
klaniak klaniak is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Underground
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by jordie
you could do
PHP Code:

<?php

echo '<input name="TOS" type="checkbox" id="TOS" value="1"';
if(
$_GET['TOS'] == 1){
    echo 
' checked';
}
echo 
'>';
?>
You got me wrong my friend, in the $params is &TOS=1 along with other values but I want it to be checked so what can I do ?



$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line makes it work under https

$result=curl_exec ($ch);
curl_close ($ch);

I don't know a proper solution
Reply With Quote
  #4 (permalink)  
Old 03-06-06, 09:23 PM
jordie jordie is offline
Wannabe Coder
 
Join Date: Jun 2005
Posts: 179
Thanks: 0
Thanked 0 Times in 0 Posts
Where do you want it checked? From what I can see you are doing it correctly.. So the probleb must be at $url...
__________________
Jordie Bodlay
php, mysql, postgres
css, xhtml
graphics, design
email me: jb2386@hotmail.com for any programming needs.
Reply With Quote
  #5 (permalink)  
Old 03-08-06, 10:52 AM
klaniak klaniak is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Underground
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
I do it corectly but it doesn't check.
I want the form to be completed automaticly and I only lack the checkbox

Reply With Quote
  #6 (permalink)  
Old 03-08-06, 08:28 PM
klaniak klaniak is offline
Wannabe Coder
 
Join Date: Apr 2005
Location: Underground
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
can somebody please help me to find a solution ?
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


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