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
Old 08-26-2004, 10:51 AM post array
Novice Talker

Posts: 11
Trades: 0
$i=0;
while ($my_array = mysql_fetch_array($result, MYSQL_ASSOC)) {

$sdate=mysql_result($result,$i,"sdate");
$edate=mysql_result($result,$i,"edate");
$price=mysql_result($result,$i,"price");{

echo "$sdate - $edate - Price from $price <input type=\"checkbox\" name=\"$var\" value=\"$val\" UNCHECKED>\n<br /><br />";
}

$i++;
}


how do i make each result/array/value a name and value and pass to next page when checkbox ticked (above code is a rough sample)
thanks
barry
ezhost is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-26-2004, 11:43 AM
Novice Talker

Posts: 9
Trades: 0
ezhost, could you explain in a little more detail what you are trying to achieve?
stigthew is offline
Reply With Quote
View Public Profile
 
Old 08-26-2004, 12:00 PM
Novice Talker

Posts: 11
Trades: 0
i am trying to acvhieve an online booking system for parents site
it all starts here http://www.sunriseholidaychalets.co....ailability.htm
where you select the dates, then the next page shows everything available where you can then select each one by checkbox
the next page should then show what was selected and then i need those results to add to cart
ezhost is offline
Reply With Quote
View Public Profile
 
Old 08-26-2004, 12:27 PM
Novice Talker

Posts: 9
Trades: 0
I've had a quick look at your site, I think I know what you're getting at...

You're on the right track by setting up your checkboxes as an array, so you can easily manipulate the selected values in the processing script. The name of all of your checkboxes will be the same, it's only the value that needs to change. Therefore, something like:

<?php

echo $sdate." - ".$edate." - Price from ".$price;
echo "<input type=\"checkbox\" name=\"accommodation[]\" value=\"".$accommodationName."\" UNCHECKED>";

?>

should give you the correct HTML. Then, in the processing script:

<?php

foreach($_POST['accommodation'] as $accommodationName){

//do whatever you need to do

}

?>

(I've assumed your Form is using the POST method)

Hope this helps!
stigthew is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to post array
 

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.34813 seconds with 12 queries