Jump to content

robincham

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

robincham's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ignace, Ialsoagree: Thanx for your help, but I cannot display the radio buttons from a foreach loop. I need to display each separately with other information (a product image and product description) in individual div's. Ideas welcome on how to take array input from the single button allowed in a list of radio button, then display array 'key/value' info individually. Carrying input from page to page is already handled via sessions. Robincham
  2. Ignace: OK, needed to parse your $keys = array_keys($fplan); foreach ($keys as $key) { echo '<input type="radio" name="plan" value="', $key, '">'; } to see it will list the radio buttons one-after-the-other from the foreach loop. However, I must place each radio button in a div that contains an image of the product and a brief product description. How may I display each radio button separately? Robincham
  3. Ignace: So, I set the array, then use $keys = array_keys($fplan); foreach ($keys as $key) { echo '<input type="radio" name="plan" value="', $key, '">'; } to setup each separate radio button, then use if (isset($_POST['plan'])) { $plan = $_POST['plan']; if (isset($fplan[$plan])) { echo 'You\'ve chosen product ', $plan, ' and the price is ', $fplan[$plan]; } } to display chosen radio button input wherever necessary, correct? Thanx in advance, Robincham
  4. Using this sample array linking a product code (RP-151, RP-171, etc) with a corresponding price (90, 100, 150) $fplan = array ( RP-151 => '90', RP-171 => '100', RP-172 => '150' ); how do I set a radio button input value to both product code and price from the array? I want users to pick ONE product/price combo (hence, radio button, not checkboxes), then display on another page the selected product code and price separately, as in "You've chosen product X and the price is Y". Thanx in advance for feedback. Robincham
  5. Receiving 'Warning: fread(): supplied argument is not a valid stream resource . . . ' when script below is used. Feedback welcome re this problem and 'not valid stream resource' in general. <html> <head><title>Image Upload</title></head> <body> <?php // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); if (isset ($_POST['submit'])) { // if form submitted, connect, upload, etc. // Connect and select. $host="localhost"; $user="user"; $password="whatever"; $database="binary_data"; if ($dbc = @mysql_connect ($host,$user,$password)) { if (!@mysql_select_db ($database)) { die ('<p>Could not select the database because: <b>' . mysql_error() . '</b></p>'); } } else { die ('<p>Could not connect to MySQL because: <b>' . mysql_error() . '</b></p>'); } $data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); $result=MYSQL_QUERY("INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) ". "VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')"); $id= mysql_insert_id(); print "<p>This file has the following Database ID: <b>$id</b>"; MYSQL_CLOSE(); } else { // else show the form to submit new data: ?> <form method="post" action="image_up.php" enctype="multipart/form-data"> Image Description:<br> <input type="text" name="form_description" size="40"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> <br>Image file to upload/store in database:<br> <input type="file" name="form_data" size="40"> <p><input type="submit" name="submit" value="submit"> </form> <?php } ?> </body> </html>
  6. Aebstract was half-right: I needed to explore other avenues of help . . . I did find a solution available via Google and learned a bit more about PHP in the process. Robin
  7. Aebstract: Could be, tho I'm not looking for someone to code for me, only someone to head me in the right direction. I've tried several obvious solutions, but with the way the script is written, I just can't seem to get what I want. Robin
  8. In attached code page, need to: 1) Display message, then exit script if user has not entered any search word(s), 2) Display message, then exit script if user has entered search word(s) but no search results returned. Also need to know where to insert solutions to above in attached code page. Thanks, Robin [attachment deleted by admin]
×
×
  • 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.