MX Send E-mail Forum :: how do i show foriegn keyed names rather than integer

This thread was displayed: 0 times


Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.

For more information about the affected products visit: www.interaktonline.com/Support/

View Threaded Show descending
Ian Raba
05-08-2007 11:41:16 GMT +2

Hi

I need to show the name of a chosen option that is from a dynamically generated dropdown in a input form. These input details are emailed.

I get the integer value of the main table but for the life of me I cannot get the name from the foreign keyed table to show???

I have read thru pages and pages of this forum and nothing seems to explain how to achieve this... I may be missing something but can someone please explain

Back | Reply | Quote | Top
Razvan Racasanu[InterAKT]Adobe Systems Romania staff
05-09-2007 11:28:35 GMT +2

Hello,

To do this, you could create a recordset on that table, that is filtered using the foreign key that you receive on POST when the form is submitted. Then, you could use this recordset in the Send Email trigger to send the actual data and not the id.

Regards,
Razvan RACASANU

Reply | Quote | Top
Ian Raba
05-11-2007 09:48:45 GMT +2

Hi Razvan

Thanks for the reply, with this method I assume the POST recordset cannot be on the same page as the insert form?

AT the moment the sendmail is on the same page as the form, do I need to move this to the thanks page and POST all info to the thanks page and then use this to send the info?

Reply | Quote | Top
Ian Raba
05-14-2007 01:40:32 GMT +2

could really do with an explanation on how to achieve this!

Reply | Quote | Top
Razvan Racasanu[InterAKT]Adobe Systems Romania staff
05-14-2007 09:24:54 GMT +2

Hello,

The form posts the data back to itself before making the redirect, so the recordset can be on the same page. You need to make a regular recordset and just filter it by the foreign key that you will get by POST when the form is submitted. Then, editing the Send Email SB, you can insert data from this recordset into the email body using Dynamic Data.

Regards,
Razvan RACASANU

Reply | Quote | Top
Ian Raba
05-14-2007 10:52:34 GMT +2

So sorry but i still don't get it... really need it resolved b4 you all dissapear

I have this dropdown menu generated from a 'product' table

<td><select name="USB_Pendrive_Model__" class="ulfront" id="USB_Pendrive_Model__">
                            <option value="Not Sure" <?php if (!(strcmp("Not Sure", $row_rscustom['USB_Pendrive_Model__']))) {echo "selected=\"selected\"";} ?>>Not Sure</option>
                            <?php
do { 
?><option value="<?php echo $row_model['product_id']?>"<?php if (!(strcmp($row_model['product_id'], $row_rscustom['USB_Pendrive_Model__']))) {echo "selected=\"selected\"";} ?>><?php echo $row_model['product_name']?></option>
                            <?php
} while ($row_model = mysql_fetch_assoc($model));
  $rows = mysql_num_rows($model);
  if($rows > 0) {
      mysql_data_seek($model, 0);
   $row_model = mysql_fetch_assoc($model);
  }
?>
                            </select>
                              <?php echo $tNGs->displayFieldError("custom", "USB_Pendrive_Model__"); ?> </td>

I need to pull the name of the model from the 'model' table

I have these relevant recordsets:

Product table:
mysql_select_db($database_usb, $usb);
$query_model = "SELECT product_id, product_name FROM product";
$model = mysql_query($query_model, $usb) or die(mysql_error());
$row_model = mysql_fetch_assoc($model);
$totalRows_model = mysql_num_rows($model);

and the filtered model table:
$colname_modelname = "-1";
if (isset($_POST['USB_Pendrive_Model__'])) {
  $colname_modelname = (get_magic_quotes_gpc()) ? $_POST['USB_Pendrive_Model__'] : addslashes($_POST['USB_Pendrive_Model__']);
}
mysql_select_db($database_usb, $usb);
$query_modelname = sprintf("SELECT * FROM model WHERE model_id = %s", GetSQLValueString($colname_modelname, "int"));
$modelname = mysql_query($query_modelname, $usb) or die(mysql_error());
$row_modelname = mysql_fetch_assoc($modelname);
$totalRows_modelname = mysql_num_rows($modelname);

and in the sendmail i'm trying to call: {modelname.model_name}
But the subsequent email is blank

What am i doing wrongplease?

I attach the relevant file

Reply | Quote | Top
Ian Raba
05-16-2007 09:29:42 GMT +2

Is this actually possible?

Reply | Quote | Top
Ionut MOICIANU
05-16-2007 15:36:09 GMT +2

Hello,

How would you like to retrieve the name of the model when you are submitting the product ID, instead of the module ID??

I don't understand how you structured your database and this page - the products table should contain the foreign key to the models table and this foreign key should be submitted from the dropdown.

Then the "modelname" Recordset that will extract the model name would be like you have it now.

Ionut

Reply | Quote | Top
© Adobe Systems Romania. All rights reserved.