Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
9 + 9 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     
addElement($hidden_id); $button_submit = new XoopsFormButton("", "submit", _MI_SENDNOW, "submit"); $form->addElement($button_submit); $form->display(); include($GLOBALS['xoops']->path('footer.php')); ?> [/code] This version puts the form in the template var (If you realy wan't to work with templates ;-)) [b]Version 2:[/b] [code] path('header.php')); if(!empty($_GET["id"])){ $id = intval($_GET["id"]); }elseif(!empty($_POST["id"])){ $id = intval($_POST["id"]); }else{ // do something if no id is set } xoops_load('xoopsformloader'); $form = new XoopsThemeForm(_MI_SEND, "form1", "send.php"); $hidden_id = new XoopsFormHidden('id', $id); $form->addElement($hidden_id); $button_submit = new XoopsFormButton("", "submit", _MI_SENDNOW, "submit"); $form->addElement($button_submit); $xoopsTpl->assign('form', $form->display()); include($GLOBALS['xoops']->path('footer.php')); ?> [/code] Hope this does what you want it to do and otherwise please try to explain what your trying to do... Greets Dylian.[/quote]" />

Re: XoopsFormHidden
by xsell on 2010/1/5 19:23:40

Dylian Thank you Man ,

I feel Very Stupid , How in the World I could Not think about that .. Your Total Correct . it Should Be .

le="color: #000000"><?php $form = new XoopsThemeForm(_MI_SEND, "form1", "send.php?id=".$id);


Not

le="color: #000000"><?php $form = new XoopsThemeForm(_MI_SEND, "form1", "send.php");


with That No need for Extra Hidden Filed , i can remove it Now ..

Shame On me , was very Simple if Paid Good attention to my Code ..

Thank you Dylian for Ponited it Out.
Re: XoopsFormHidden
by Dylian on 2010/1/5 10:25:01

If you look at the source code in your browser you'll see that the id field does have a value... (a html code lik this generated: <input type="hidden" name="id" value="1234" />

Or is this what you want?
1. user goes to id.php?id=123;
2. user fills in the visible fields;
3. user submits form and goes to send.php?id=123
4. send.php parses the data the user filled in.

If so, use this code:
<?php require('mainfile.php'); include($GLOBALS['xoops']->path('header.php')); if(!empty($_GET["id"])){ $id = intval($_GET["id"]); }elseif(!empty($_POST["id"])){ $id = intval($_POST["id"]); }else{ // do something if no id is set } xoops_load('xoopsformloader'); // Added the id to the action url instead of putting it in a hidden field $form = new XoopsThemeForm(_MI_SEND, "form1", "send.php?id=".$id); //$hidden_id = new XoopsFormHidden('id', $id); //$form->addElement($hidden_id); $button_submit = new XoopsFormButton("", "submit", _MI_SENDNOW, "submit"); $form->addElement($button_submit); $form->display(); // OR //$xoopsTpl->assign('form', $form->display()); include($GLOBALS['xoops']->path('footer.php')); ?>


Greets Dylian.
Re: XoopsFormHidden
by xsell on 2010/1/5 3:25:22

Thx Dylian ,

My way and your way Still Give the Same Result .

Ok this The Problem in Simple Words .

the $ID Value Should Be Replaced with the actual ID Number.

But For Some reason the $ID Value if i make the Form Hidden Stays Empty.

See the Image Explain to You Better.
Resized Image
Re: XoopsFormHidden
by Dylian on 2010/1/5 1:05:36

Don't really get what your trying to do, but this is the working version of the script you posted above.

(I removed the template vars as they ain't needed for proper functioning of the script)

Version 1:
<?php require('mainfile.php'); include($GLOBALS['xoops']->path('header.php')); if(!empty($_GET["id"])){ $id = intval($_GET["id"]); }elseif(!empty($_POST["id"])){ $id = intval($_POST["id"]); }else{ // do something if no id is set } xoops_load('xoopsformloader'); $form = new XoopsThemeForm(_MI_SEND, "form1", "send.php"); $hidden_id = new XoopsFormHidden('id', $id); $form->addElement($hidden_id); $button_submit = new XoopsFormButton("", "submit", _MI_SENDNOW, "submit"); $form->addElement($button_submit); $form->display(); include($GLOBALS['xoops']->path('footer.php')); ?>


This version puts the form in the <{$form}> template var (If you realy wan't to work with templates )

Version 2:
<?php require('mainfile.php'); include($GLOBALS['xoops']->path('header.php')); if(!empty($_GET["id"])){ $id = intval($_GET["id"]); }elseif(!empty($_POST["id"])){ $id = intval($_POST["id"]); }else{ // do something if no id is set } xoops_load('xoopsformloader'); $form = new XoopsThemeForm(_MI_SEND, "form1", "send.php"); $hidden_id = new XoopsFormHidden('id', $id); $form->addElement($hidden_id); $button_submit = new XoopsFormButton("", "submit", _MI_SENDNOW, "submit"); $form->addElement($button_submit); $xoopsTpl->assign('form', $form->display()); include($GLOBALS['xoops']->path('footer.php')); ?>


Hope this does what you want it to do and otherwise please try to explain what your trying to do...

Greets Dylian.
Re: XoopsFormHidden
by xsell on 2010/1/2 0:20:55

up :)

Who's Online

208 user(s) are online (162 user(s) are browsing Support Forums)


Members: 0


Guests: 208


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits