phpuse Posted April 18, 2010 Share Posted April 18, 2010 There is a FORM, INPUT type="text". And there are three buttons. Kindly ask you to help with this: after you put some info to the form, you push one button and you go to one URL. If you push another button, you go to different URL. And if you push the third button you go to the third different URL. But the info for this goto is taken from the INPUT type="text" form. It is 5-7 figures that are added to the URL after "?". It looks like that: www.somesite.com/archive.php?ndx= and here is the info from the form (1234567, like this) Link to comment https://forums.phpfreaks.com/topic/198919-3-buttons-and-a-form-how-to-make-urlvalue-of-input-typetext/ Share on other sites More sharing options...
Jax2 Posted April 18, 2010 Share Posted April 18, 2010 Could you show your code so we have some idea of what you're talking about? Link to comment https://forums.phpfreaks.com/topic/198919-3-buttons-and-a-form-how-to-make-urlvalue-of-input-typetext/#findComment-1044135 Share on other sites More sharing options...
phpuse Posted April 18, 2010 Author Share Posted April 18, 2010 Could you show your code so we have some idea of what you're talking about? I made it this way, using onClick <form action="" target="_blank"> <input type="text" id="index" name="index" maxlength="10" size="10" style="font-size:25; text-align:center"> <input class="btns" type="button" id="rekl" name="rekl" value="Adds" onClick="location.href='http://www.somesite/adds.php?id='+document.getElementById('index').value";> <input class="btns" type="button" id="art" name="art" value="Articls" onClick="location.href='http://www.somesite/artcls.php?id='+document.getElementById('index').value";> <input class="btns" type="button" id="pics" name="pics" value="Photos" onClick="location.href='http://www.somesite/pics.php?id='+document.getElementById('index').value";> And it works correctly, but I'd lke to make it using php and don't know how. Link to comment https://forums.phpfreaks.com/topic/198919-3-buttons-and-a-form-how-to-make-urlvalue-of-input-typetext/#findComment-1044145 Share on other sites More sharing options...
Jax2 Posted April 18, 2010 Share Posted April 18, 2010 Oh, I see what you're saying now ... Pretty easy, (pseudo code) if (isset($_post['ads'])) { $id=$_POST['ID']; header('Location: http://www.somesite.com/ads.php?id=".$id."'); } ELSE if (isset($_post['articles .... etc } ELSE { form, method = post, action = php self input txt name ID submit1 name=ads submit2 name=articles submit3 name=photos } Something like that would work fine ... I'm sure there's an even easier way as well, but that's how I'd do it. Link to comment https://forums.phpfreaks.com/topic/198919-3-buttons-and-a-form-how-to-make-urlvalue-of-input-typetext/#findComment-1044149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.