Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 29-08-07
Registered User
 
Join Date: Nov 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
diesel77 is an unknown quantity at this point
  Compare Checkboxes

Im sure your all aware of those checkboxes on price comparison sites that allow you to compare product specs side by side....well thats what im trying to do with not much luck.

my checkboxes are not submitting the data to the results page

Im using Dreamweaver with a MySql database, so ive made a enum column for the Y - N values, set the default to N


What should i be doing? i cant really find any helpful tutorials on this.

should there be a recordset query on the results page that captures it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 29-08-07
accelerator's Avatar
Online shopping rocks!
 
Join Date: Nov 2004
Location: England
Posts: 1,316
Thanks: 8
Thanked 29 Times in 26 Posts
accelerator is an unknown quantity at this point
  Re: Compare Checkboxes

What language are you coding in? Post your script and people may be able to help.

Rgds

Accelerator
__________________
WebRef.eu - Web Development Resources for the Online Entrepreneur
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 29-08-07
tbp tbp is offline
Registered User
 
Join Date: Dec 2006
Posts: 1,999
Thanks: 0
Thanked 18 Times in 18 Posts
tbp is an unknown quantity at this point
  Re: Compare Checkboxes

Post your code and i`ll show you how to fix it.

Be around a bit longer today, but have to go to hospital tomorrow. Will hopefully be recovered enough to be online in the evening, otherwise i`ll have a look friday.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 30-08-07
Registered User
 
Join Date: Feb 2006
Location: Gillingham
Posts: 503
Thanks: 0
Thanked 0 Times in 0 Posts
Donk is an unknown quantity at this point
  Re: Compare Checkboxes

Here's a piece of code that might give you some ideas:

PHP Code:
<pre>
<form method="post">
<?php
if ($_POST['check']){
foreach (
$_POST['check'] as $key=>$value){
echo 
$key."--".$value."<br />";
}}

for (
$i=0;$i<10 ;$i++)
{
?>
<input name="check[<?php echo $i;?>]" type="checkbox" value="Y" />
<? ?>
<input name="submit" type="submit" value="Submit" />
</form>
</pre>
__________________
They came for my 404 and I said nothing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 30-08-07
Registered User
 
Join Date: Nov 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
diesel77 is an unknown quantity at this point
  Re: Compare Checkboxes

Im not a coder just a dreamweaver, but making an effort to pick things up.
Remember this is inside a repeat region.

On the results page i have draged a data source that corresponds to the enum ('Y', 'N') table column from the Data Bindings panel ....so far its only returning 'N'

Ive tried toying with the following two codes (prod_check is my enum column)

Code:
<form action="un3.php" method="post" name="form1"><?php do { ?><table width="37%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><input type="checkbox" name="checkbox[<?php echo $row_Recordset1['prod_id']; ?>]" value="Y"></td>
      </tr>
  </table><?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?><p>
    <input type="submit" name="Submit" value="Submit">
    </p></form>
Code:
<form action="un3.php" method="post" name="form1"><?php do { ?><table width="37%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><input <?php if (!(strcmp($row_Recordset1['prod_check'],"Y"))) {echo "checked=\"checked\"";} ?> type="checkbox" name="checkbox[<?php echo $row_Recordset1['prod_id']; ?>]" value="Y"></td>
      </tr>
  </table><?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?><p>
    <input type="submit" name="Submit" value="Submit">
    </p></form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 30-08-07
tbp tbp is offline
Registered User
 
Join Date: Dec 2006
Posts: 1,999
Thanks: 0
Thanked 18 Times in 18 Posts
tbp is an unknown quantity at this point
  Re: Compare Checkboxes

With your code:

PHP Code:
<input name="check[<?php echo $i;?>]" type="checkbox" value="Y" />
You are half right. You have two ways of doing this. You can either do:

PHP Code:
<input name="check[]" type="checkbox" value="Y" /> 
Which would put all the results into an array called check, which you can read using

PHP Code:
$_POST['check'
Or you could give each input box a unique name eg

PHP Code:
<input name="check_<?php echo $i?>" type="checkbox" value="Y" />
You could then loop through the $_POST array, and see if the field contains "check" and then split it if it does to get the number eg


PHP Code:
foreach($_POST as $key=>$value){
  if(
substr_count($key,"check") > 0){
    
$temp explode("_",$key)
    
$variable_number $temp[1];
    
$variable_value $value;
  }

You just can't assign an index for the array in the HTML as you were doing.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 31-08-07
Registered User
 
Join Date: Nov 2005
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
diesel77 is an unknown quantity at this point
  Re: Compare Checkboxes

Hey Tbp,
Ive used your code, but im still getting the same problem.
I stuck a ";" before foreach and $variable_number as it was giving me a Parse error: syntax error

Code:
<form name="form1" method="post" action="un3.php">
<?php $_POST['check'];
  foreach($_POST as $key=>$value){ 
  if(substr_count($key,"check") > 0){ 
    $temp = explode("_",$key);
    $variable_number = $temp[1]; 
    $variable_value = $value; 
  } 
}  
?>  
  <?php do { ?>
    <table width="33%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><input name="check[<?php echo $row_Recordset1['prod_id']; ?>]" type="checkbox" value="Y" /></td>
      </tr>
          </table>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?><p>
    <input type="submit" name="Submit" value="Submit">
  </p>
  <p>&nbsp;</p>
</form>
Ive also tried

Code:
<td><input name="check[]" type="checkbox" value="Y" /></td>
Code:
<td><input name="check[<?php echo $i; ?>]" type="checkbox" value="Y" /></td>
Code:
<td><input name="check_<?php echo $i; ?>" type="checkbox" value="Y" /></td>
Im wondering if the problems lies with the ENUM Values in the database or something from the results page that would capture this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
InThe Paper ---How Do Our Stats Compare? ian philipson The Affiliate Marketing Lounge 2 15-09-06 02:16 PM
Compare merchants prices? eurospurs Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 9 14-06-06 07:26 AM
Campaign Pirates Part 2 - Compare Online - OMG UKOffer The Affiliate Marketing Lounge 13 08-04-05 10:43 PM
Compare price script Matt Seigneur Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 1 24-08-04 09:37 PM
Priceline - How do Others Results Compare? Qui Gon Jinn TradeDoubler 12 04-04-03 07:41 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7