Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 332
  • Last Modified:

need two submitts to inject the data php smarty pages

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
0
sydneyguy
Asked:
sydneyguy
  • 7
  • 3
1 Solution
 
Ray PaseurCommented:
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.
0
 
sydneyguyAuthor 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
0
 
sydneyguyAuthor 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?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sydneyguyAuthor 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
0
 
sydneyguyAuthor 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
0
 
Ray PaseurCommented:
I'm not familiar with Smarty Templates, but I can show you something that would be easy to try and that seems intuitively OK:

if {php}print $_GET['prosupad']{/php} allows me to print to the screen the correct value on the submit

You might try something like this:
<td height="67%"> <input class="provservxx" maxlength="100" name="xxx" value="<?php echo $_GET['prosupad']; ?>"/> </td>
0
 
sydneyguyAuthor 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
0
 
sydneyguyAuthor Commented:
as always ray your support has got me across the line, thanks for all your help
garry
0
 
sydneyguyAuthor Commented:
thanks for the help ray
0
 
Ray PaseurCommented:
Thanks for the points.  Glad the answer was useful -- it was more out of instinct than knowledge! ~Ray
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now