Jump to content

InLikeMe

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

InLikeMe's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is there any particular PHP function which retrieves the max value of a query? To be specific: I have the query: $max_customer = mysql_query('SELECT max(customer_id) FROM customers'); and when I "echo" it echo $max_customer; I get "Resource id #3" When I use sql functions like mysql_ fetch_ array, mysql_ fetch_ assoc inside a while loop I get the word "Array". With mysql_ fetch_ object I get error. Is there any kind of "get_value" function? which will do sth like that --> $max_customer = get_value('SELECT max(customer_id) FROM customers'); Thnx
  2. I've placed the radio buttons within the while statement and I've also added the radiogroup (I found its syntax is like this) <FORM name ="form1" method ="post" action ="./yourdetails.php"> <radiogroup id="chosen_bunga"> <?php while ($row = mysql_fetch_assoc($check_date)) {?> <div id="heading"> <radiobutton value= "<?php $row['bungalow_id']; ?>"/> <?php echo $row['bungalow_id']; echo $row['name']; ?> </div> <div id="description"> <?php echo $row['description']; ?> <br> Price: <?php echo $row['pricepernight']; ?> euro <br> No of beds: <?php echo $row['beds']; ?> <br> </div> <?php } //end of while ?> </radiogroup> <input type="hidden" name="chosen_name" value="rosana" > <input type="hidden" name="chosen_bunga" value="<?php echo $_POST["chosen_bunga"]; ?>"> <input type="submit" name="book_submit" value="Book"> </FORM> ...but now no radio buttons appear . I think it doesnt understand the <radiogroup> or <radiobutton> command. Isnt it a javascript object? @GKWelding Neither with that code works. The following line isnt necessary? --> <input type="hidden" name="chosen_bunga" value="<?php echo $_POST["chosen_bunga"]; ?>">
  3. Hello everyone! I have a problem with radio buttons and php. I'm trying to pass the value of the radio button that has been selected, to another page. I have a query: $query = sprintf("SELECT bungalow_id, name, description, pricepernight, beds FROM bungalows WHERE bungalow_id <> ALL (SELECT bungalow_id FROM bungalow_diary WHERE date BETWEEN '$checkin_year-$checkin_month-$checkin_day' AND '$checkout_year-$checkout_month-$checkout_day')"); $check_date = mysql_query($query); And then the code: <?php while ($row = mysql_fetch_assoc($check_date)) { ?> <div id="heading"> <input type="radio" name="chosen_bunga" value= "<?php echo $row['bungalow_id']; ?>"> <?php echo $row['bungalow_id']; echo $row['name']; ?> </div> <div id="description"> <?php echo $row['description']; ?> <br> Price: <?php echo $row['pricepernight']; ?> euro <br> No of beds: <?php echo $row['beds']; ?> <br> </div> <?php } ?> <FORM name ="form1" method ="post" action ="./yourdetails.php"> <input type="hidden" name="chosen_name" value="rosana" > <input type="hidden" name="chosen_bunga_name" value="<?php echo $_POST["chosen_bunga"]; ?>"> <input type="submit" name="book_submit" value="Book"> </FORM> Now the "yourdetails.php" contains the following: <?PHP $selected_bunga = $_POST['chosen_name']; $test = $_POST['chosen_bunga_name']; print $selected_bunga; print $test; ?> So when I press the "Book" button, appears the "youdetails.php" page showing $test value which is "rosana". However the $selected_bunga has nothing in it, so it doesnt show anything. Obviously the $chosen_bunga_name although it should, hasn't taken the value of the chosen radio button(value= "<?php echo $row['bungalow_id']; ?>"). Why does this happen? I wonder if it is perplexed because of the query. Any opinions? Thanx in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.