We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

need two submitts to inject the data php smarty pages

Medium Priority
349 Views
Last Modified: 2012-05-11
have a site with 3 submitt buttons, s, p, and a on images, when i submit the page with button press the page is submitted as per ht url code http://localhost/home/hiv/public_html/signup.php?prosupad=p is submitted and injected into the session varable,
but when you look at the smarty php compiled varables it shows the value of the last press, that when you submit the value a as example,  it seems to retain the varable and needs a second submit with the one same button to actually make the varable in the text box the same as what is submitted. as if its one step behind.
not sure it the explanation is a little vague having a bit of trouble describing the problem
any ideas
Comment
Watch Question

Most Valuable Expert 2011
Author of the Year 2014

Commented:
Not sure what you're looking at, but some variables, especially cookies, can be a little counter-intuitive in PHP.  Example... When you use setcookie() the cookie gets set on the client machine, but the value is not placed in $_COOKIE.  That placement happens before your script starts.  So the NEXT script sees the cookie, but not the script that sets the cookie.  Easy fix: Add the cookie name-value pair to $_COOKIE yourself.  Maybe there is something in smarty that is behaving this same way.

Author

Commented:
i can access the $_GET['prosupad'] which is what i need and can see it when i get to the php compiled side but not sure how to code this in the tpl file so that it become intelegent when its compiled.
<td height="67%"> <input maxlength="100" name="txtprovserv" value=" ... ?????? ....."/> </td>
have tried the below but i am doing something wrong am looking at the net but have not found the way to access the _GET var
<td height="67%"> <input maxlength="100" name="txtprovserv" value="{$_GET['provserv']}"/> </td>
can get the session via $smarty.session.prosupad so thought the other may work the same

Author

Commented:
this gives me access to the varable
{php}print $_GET['prosupad']{/php}
is this ok to use or it it a not good programing practice?

Author

Commented:
if {php}print $_GET['prosupad']{/php} allows me to print to the screen the correct value on the submitt
how do you extract it and then plce it in
<td height="67%"> <input class="provservxx" maxlength="100" name="xxx" value="{ ...??????....}"/> </td>
were it need to be found

Author

Commented:
Add the cookie name-value pair to $_COOKIE yourself.  Maybe there is something in smarty that is behaving this same way.
not sure what you mean by this ray
Most Valuable Expert 2011
Author of the Year 2014
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
how close were you ray,your line above just printed the php line into the index field but below did work
                                    <td height="67%"> <input class="provservxx" maxlength="100" name="xxx" value="{php}print $_GET['prosupad']{/php}"></td>

this plugs the data your your idea got me over the line smarty needs {php} instead of ="<?php
now not sure if this leads me open to some type of injection, but it doesnot cause any security risk so will use it till i get some more knowledge on the subject

Author

Commented:
as always ray your support has got me across the line, thanks for all your help
garry

Author

Commented:
thanks for the help ray
Most Valuable Expert 2011
Author of the Year 2014

Commented:
Thanks for the points.  Glad the answer was useful -- it was more out of instinct than knowledge! ~Ray
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.