This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Help needed | Php snippet

dear all,
i would like to build a php snippet able to interact with smsgateway.module; the goal is to have a submit button(or link) to let the function smsgateway_sendmessage run, but i'm actually a php beginner and i don't know how to get it works. I've tried to "invent" something, but still get problems.
it would be great if someone already dealed with a similar problem and/or could help me getting the right code.

many many many thanks in advance.

That's what i wrote down:

<?php 
global $user;
profile_load_profile($user->uid);  
$destination_number=($user->profile_cel); //i call back the mobile number from user profile
$message_body=($user->name) . ", text text text. -- staff.mysite.com "; //i define a message body
//and then try to build the form ?>
<form name="sms" method="post" action="<?php smsgateway_sendmessage( $destination_number, $message_body) ;?>">
To get your sms just click here!<br/>
<input name="set" type="submit" value="submit">
</form>

as you can see, even if it is a very simple snippet i get problems... :(
i guess i should insert the function in a separate php file because i cannot embed it in action="" attribute... but it would be "outside drupal environment" and functions would be undefined. (i've tried it).
As it appears, the script sends sms... but it happens every time the page is laoded... even if the submit button isn't clicked ever.

Problem understanding the 4.7 Form API?

I've been trying for a few hours now, and I've done a bunch of searching, and I'm really not sure what it is I'm doing wrong.

I used this code:


function drumath_settings() {
$form['Grid Color'] = array(
'#type' => 'textfield',
'#title' => t('Default color'),
'#size' => 12,
'#default_value' => '#d6d6d6',
'#validate' => array('is_valid_hex_color' => array('Grid Color')),
'#description' => t('Choose the color of the graph grid.'),
);
$form['Frame Color'] = array(
'#type' => 'textfield',
'#title' => t('Default color'),
'#size' => 12,
'#default_value' => '#eeeeee',
'#validate' => array('is_valid_hex_color' => array('Frame Color')),
'#description' => t('Choose the color of the graph frame.'),
);
$form['Canvas Color'] = array(
'#type' => 'textfield',
'#title' => t('Default color'),
'#size' => 12,
'#default_value' => '#ffffff',
'#validate' => array('is_valid_hex_color' => array('Canvas Color')),
'#description' => t('Choose the color of the graph canvas.'),
);
$form['Border Color'] = array(
'#type' => 'textfield',
'#title' => t('Default color'),
'#size' => 12,
'#default_value' => '#000000',
'#validate' => array('is_valid_hex_color' => array('Border Color')),
'#description' => t('Choose the color of the graph border.'),
);
$form['Scale Color'] = array(

altertype for Drupal 4.7

The altertype module (hosted at http://www.settingtheworldtorights.com/node/417) allows me to change the type of a node. The current version is for Drupal 4.6. Has anyone upgraded it to support Drupal 4.7?

how can i add additional variables with a module?

hi

i'd like to add additional variables to my pages. i'd like to be able to add additonal tags like

<?php print $mytestvar1 ?>

how is this possible? any example available?

Regards
Marc

Adding name property to form using forms API

I'm trying to add the name property to a form. For example, I want to generate a form statement like:

[form action="/funstuff" name="handy" id="junk" method="post"]

But using #name doesn't seem to do anything:

$form['#action'] = '/funstuff';
$form['#id'] = 'junk';
$form['#name'] = 'handy';

Any clues?

--J

Manual File Attach

Is anyone aware of a plugin or modified upload plugin that allows an admin to manualy attach files to a node? As in the file is to large to upload with php, and needs to be uploaded with ftp. I have many files to attach, and dont want to have to manualy add the entries to the database.

I've already started to code the plugin, however I'd like to know if something like this already exists before I dig in to deep!

Thanks!

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions