0

I would like the results from this script(it is working but results open in same window)to be displayed in a new window?
Here is the code:

[<?php

function new_module_menu() {
  $items = array();
  $items['new_module/form'] = array(
    'title' => t('My form'),
    'page callback' => 'new_module_form',
    'access arguments' => array('access content'),
    'description' => t('My form'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function new_module_form() {
  return drupal_get_form('new_module_my_form');
}

function new_module_my_form($form_state) {
  $form['name'] = array('#type' => 'textfield','#title' => t('Keyword'),'#size' =>10,
    '#maxlength' => 10,);

  // Adds a simple submit button that refreshes the form and clears its contents -- this is the default behavior for forms.
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Submit',
  );

  return $form;
}



// Modifies this function so that it will respond appropriately based on
// which page was submitted. If the first page is being submitted,
// values in the 'storage' array are saved and the form gets 
// automatically reloaded.
// If page 2 was submitted, we display a message and redirect the 
// user to another page.

function new_module_my_form_submit($form, &$form_state) {
      /* 
     Normally, some code would go here to alter the database with the data
     collected from the form. Sets a message with drupal_set_message()
     to validate working code.
     */
      $user_keyword = $form_state['values']['name'];

// Connects to your Database

mysql_connect("localhost","drupaluser","sep221984")or die(mysql_error()); 
mysql_select_db("drupal") or die(mysql_error());
$query = "SELECT `languagearts`.`Description`\n"
    . "FROM languagearts\n"
    . "WHERE ((`languagearts`.`Description` LIKE \"%$user_keyword%\") AND (`languagearts`.`Grade` = 

\"Grade 6\"))\n AND (`languagearts`.`Label` like \"p%\")\n"
    . " ";
$result =  db_query($query);
  while ($row = db_fetch_object($result)) {
  $Description="{$row->Description}";
  $url_pr=str_replace("http://","",$url);
  echo "<strong>".$org."</strong><br>\n";
    if($Description!=""){ echo $Description."<br>\n"; }
  echo "<br>\n";
  }
  while($a_list = db_fetch_object($result)){
  foreach ($a_list as $array => $a){
  }
print("<tr><td>".$a."</td></tr>\n");

if(isset($_SESSION['<strong class="highlight">page</strong>'])) {

    echo "<meta http-equiv='refresh'  content='0.5'>";

unset($_SESSION['<strong class="highlight">page</strong>']);
} else { }


}

    drupal_set_message('Your form has been submitted');
    unset ($form_state['storage']); // This value must be unset for 
                                    // redirection! This is because
                                    // $form_state['rebuild'] gets set to TRUE
                                    // when 'storage' is set. See code sample
                                    // #9 for more on this.

   $form_state['redirect'] = 'node/5'; // Redirects the user.
  }

]

Edited by mike_2000_17: Fixed formatting

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by urlstwohim
0

DO you want the echo to be in a new window? if so which echo?

Edited by ApocDen: n/a

0

I am not understanding your question?
I want:print("<tr><td>".$a."</td></tr>\n");
to be echoed to a new window.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.