NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Form Submit changes url variable

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 03-15-2006, 02:28 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
ridesign1's Avatar
Join Date: Mar 2005
Posts: 866
ridesign1 has a spectacular aura aboutridesign1 has a spectacular aura about
 



Question Form Submit changes url variable


Hi,
Is it possible to create a page where a user would type in a number in a box and press submit e.g. 12

and then it goes to the url: http://www.newdesignworld.com/browse-12.html


Any code would be great

thanks
ridesign1 is offline  
Old 03-15-2006, 02:39 PM   #2 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 608
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
I would do this:

<form action="redirect.php" method="post">
<input type="text" name="page" value="123" />
<input type="submit" />
</form>

then on redirect.php:
PHP Code:
<?php
$page 
$_POST['page'];
settype($page,"integer");
????: NamePros.com http://www.namepros.com/programming/177104-form-submit-changes-url-variable.html
header("Location: http://www.newdesignworld.com/browse-".$page.".html");
?>
You might be able to do it with javascript, not needing a php page. I'll try making something...

edit:
Haven't tested, but should work:
Code:
<script>
function doSomething (form) {
var pageNum = parseInt(form.page.value);
window.location = "http://www.newdesignworld.com/browse-" + pageNum + ".html";
}
</script>
<form action="" method="post">
<input type="text" name="page" value="123" />
<input type="submit" onClick="doSomething(this.form);" />
</form>
__________________
ask me about the internet
Last edited by Jim_; 03-15-2006 at 02:46 PM.
Jim_ is offline  
Old 03-15-2006, 03:57 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
ridesign1's Avatar
Join Date: Mar 2005
Posts: 866
ridesign1 has a spectacular aura aboutridesign1 has a spectacular aura about
 



thanks jim,
the first one worked using the php file, but with the 2nd one, i added that to a page but it just comes back to the same page.
ridesign1 is offline  
Old 03-15-2006, 04:19 PM   #4 (permalink)
NamePros Regular
 
Jim_'s Avatar
Join Date: Aug 2005
Location: NY, USA
Posts: 608
Jim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to beholdJim_ is a splendid one to behold
 


Save The Children
try adding onsubmit="this.disable=true;" to the <form> tag on the javascript version.
__________________
ask me about the internet
Jim_ is offline  
Old 03-15-2006, 06:42 PM   #5 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,792
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
Maybe instead of:
var pageNum = parseInt(form.page.value);
use
var pageNum = parseInt(getElementById('page').value);

and add id="page" to the input.
Dan is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
PPC explained Cyberian Domain Newbies 0 01-20-2006 01:46 PM
PHP Form Submit Code... Zoosushi Programming 4 06-13-2005 01:46 AM
Paypal Settlement CMachuca The Break Room 3 07-31-2004 10:14 PM
PAYPAL Litigation johnn Domain Name Discussion 6 07-31-2004 09:51 PM
Paypal Settlement Lord The Break Room 2 07-30-2004 09:30 PM

 
All times are GMT -7. The time now is 02:11 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger