Elxis CMS Forum

Support => Technical support => Topic started by: machinakias on February 14, 2008, 13:31:11

Title: need a button to redirect to another page
Post by: machinakias on February 14, 2008, 13:31:11
hi all...i have this code:
<tr class="order_table">
<th colspan="3">
$lang[Summary_cost]
</th>
<th id="summaryCost">
$aList[fSummary]
</th>
</tr>
<tr class="tfoot">
<td colspan="4">
CHECK OUT<input type="submit" value="$lang[send]" class="submit" />
</td>
<tr class="tfoot">
<td colspan="4">
CREDIT CARD <input type="submit" value="$lang[send1]" class="submit" />
</td>
==============================
these are two buttons...(one copied from the other) 
what i need is the one of the two buttons to redirect to another page,anywhere....doesn't matter....

any ideas please? cause i'm new in php if possible pls send me some example code....) ;)
Title: Re: need a button to redirect to another page
Post by: datahell on February 14, 2008, 13:33:51
Use javascript.

Code: (html) [Select]
<input type="button" onclick="javascript:dosomething('a');" value="<?php echo $lang[&#39;send&#39;]; ?>"  class="submit" />
<input type="button" onclick="javascript:dosomething('b');" value="<?php echo $lang[&#39;send1&#39;]; ?>" class="submit" />
Title: Re: need a button to redirect to another page
Post by: machinakias on February 14, 2008, 14:17:39
still dont get it done..i cant find the correct way...pls give me some clear answer if you please... i spend a lot of time trying various things....i just CANT do it....i know shit about scripts.... :-\
Title: Re: need a button to redirect to another page
Post by: machinakias on February 14, 2008, 20:26:56
 :-\ any one else got an idea to help me??? :'(
Title: Re: need a button to redirect to another page
Post by: Olympion on February 14, 2008, 20:51:10
Code: [Select]
<form action="http://www.tzatziki.gr">
<input type="submit" value="Button TEXT BLA BLA">
</form>

Μη ξεχασεις να αλλαξεις το τζατζικι (http://www.tzatziki.gr/)    ;D
Title: Re: need a button to redirect to another page
Post by: machinakias on February 14, 2008, 22:17:48
kale mou file se yper eyxaristw giati kat'arxin mou apanthses....deyteron giati gelasa me to oraio sxolio sou.....pragmatika kalo...8a h8ela omos na se kouraso ligo kai na mou dwseis ligi boh8eia akoma mias ki eimai mesanyxta....egw exw ayto to rimadokodika...kai mou dineis ena allo kodika....aytos pou 8a kollisei me to diko mou kommati? 8ymisou oti einai dyo ta button,to ena copy tou allou...apla 8elw to ena apo ta dyo na kanei redir se alli selida....exw 3 meres pou paleyw me ekatontades grammes kai dekades posts na brw epitelous mia akri....se 8ermoparakalo,gine ligo pio safis....8a mou swseis ta neyra!!!
(parepiptontos,oraio to site sou! ki eimai kai fun tou tzatzikiou.... :D) elpizw na mi ginomai spastikos....eyxaristw poly!

(an tyxon xreiastei,8a steilw olo ton kodika...an boi8aei etsi..)
Title: Re: need a button to redirect to another page
Post by: Olympion on February 14, 2008, 22:45:56
Code: [Select]
<tr class="tfoot">
<td colspan="4">
CHECK OUT<input type="submit" value="$lang[send]" class="submit" />
</td>
<tr class="tfoot">
<td colspan="4">
CREDIT CARD <input type="submit" value="$lang[send1]" class="submit" />
</td>


<tr class="tfoot">
<td colspan="4">
<form action="http://www.tzatziki.gr/">
Γραψε οτι θες  <input type="submit" value="Button TEXT BLA BLA">
</form>
</td>


Αναλογα πως θελεις να εμφανιστει, πανω,κατω,δεξια,αριστερα,  παιξε με τα td/tr.   :)
Title: Re: need a button to redirect to another page
Post by: machinakias on February 16, 2008, 11:42:15
eyxaristw poly...shmera 8a kanw th dokimh kai elpizw epitelous na paizei...giati exoun paiksei ta neurakia mou (kai ta dika sas...) ;)
Title: Re: need a button to redirect to another page
Post by: Ivan Trebješanin on February 16, 2008, 12:38:21
Hi guys, please use english in this part of the forum ;)
Title: Re: need a button to redirect to another page
Post by: machinakias on February 16, 2008, 13:41:22
yo! you got it! i was asking this: i use this part of code to create two buttons in quick cart.the one is used to checkout as usual,and the other one to redirect to a bank payment page.that's my question.how to make this button redirect....i gave the part of the code,cause i cant find what to do or where...
for info to others,i copied the code from the original button and i created another.the thing is that the two buttons are going to the same page.so,i need to fix the redirect...thanks Ivan!
(by the way,i hope you're ok!) :)
Title: Re: need a button to redirect to another page
Post by: datahell on February 16, 2008, 14:05:08
You can only do this with javascript. There are many ways you can do it with javascript. Add an "onsubmit", or an "onclick" event. When someone clicks a button a javascript function will submit the form and based on which button he clicked he will be redirected to another page. Or better the function's action will change to the desired url. It is a very simple task in javascript. You can even study includes/js/elxis.js file to see how the Elxis's submit buttons work and do something similar. Javascript functions to look: submitform and submitbutton.

Here is a sample (should work, I have nt test it):

Code: (javascript) [Select]
<script language="javascript" type="text/javascript">
<!--
function mysubmit(act) {
var myform = document.formname;
if (act == 1) {
myform.action = "test1.php";
} else {
myform.action = "test2.php";
}
try { myform.onsubmit(); }
catch(e){}
myform.submit();
}
//-->
</script>

And the HTML part:
Code: (html) [Select]
<form name="formname" action="test1.php" method="POST">
<input type="button" id="sub1" name="sub1" onclick="mysubmit(1);" value="Submit" />
<input type="button" id="sub2" name="sub2" onclick="mysubmit(2);" value="Submit" />
</form>

Modify it as needed.
Title: Re: need a button to redirect to another page
Post by: machinakias on February 16, 2008, 18:26:29
thanks for your help guys,but i still dont get it right...the file that i use for modification is a .tpl (from quickcart) so i cant make it work... which html to modify? i'm totally lost...the pages of the quickcart are php,and also uses .tpl files....i send the hole thing in case it helps.... it opens with notepad...i renamed the .tpl to DOC

[old attachment deleted by admin]