Free Web Hosting Forum
(#1)
Old
M.Qayyum M.Qayyum is offline
Senior Member
M.Qayyum is on a distinguished road
 
Posts: 125
Join Date: Jul 2009
Location: Pakistan
Default Submit form content via url - 11-29-2009, 02:45 PM

I have a form

<form action="http://www.smarturl.uni.cc/index.php" method="post" target="_blank">
<table align="center" cellpadding="5" bgcolor="#E7E7F7">
<tr>
<td>
<b><font face="Verdana"><font size="2">Enter a long URL to make </font>
<a href="www.smarturl.uni.cc"><font size="2">Smart URL</font></a></font>:</b><br />
<input type="text" name="longurl" size="30"><input type="submit" name="submit" value="Make Smart URL!">
</td>
</tr>
</table>
</form>


i want to send this form contents from url like that

http://www.smarturl.uni.cc/index.php...&action=submit

But it cant work for me.plz help


My latest website: http://www.sourcecodes.uni.cc
Reply With Quote
(#2)
Old
sandstorm140's Avatar
sandstorm140 sandstorm140 is offline
Developer
sandstorm140 is on a distinguished road
 
Posts: 983
Join Date: Sep 2009
Location: huHU
Default 11-29-2009, 05:01 PM

You need to add some code that checks if the submit action exists when the page loads. If it does then do what you want your form to do.

in php you can do this with:
if ($_GET['action'] == 'submit') { }


STOP! Your question may have already been answered!
Check the FAQs & FAQs Forums before submitting your question.

Don't bother PMing me for I have them blocked

Reply With Quote
(#3)
Old
iwcu's Avatar
iwcu iwcu is offline
Junior Member
iwcu is on a distinguished road
 
Posts: 11
Join Date: Nov 2009
Location: Guernsey
Send a message via MSN to iwcu
Default 11-30-2009, 11:21 AM

If you're submitting through the URL you'll also want to change method="post" into method="get" .


Oh my, I have a blog.
Reply With Quote
(#4)
Old
bigal's Avatar
bigal bigal is offline
Senior Member
bigal is on a distinguished road
 
Posts: 196
Join Date: Mar 2009
Location: Brisbane, Australia
Default 11-30-2009, 12:27 PM

You want to fetch the longurl form value in the link?
http://www.smarturl.uni.cc/index.php?longurl=$longurl

how about this way?

Displays the form, request for value and submit,
if longurl value submited, header to
http://www.smarturl.uni.cc/index.php?longurl=$longurl

PHP Code:
<?php

if (isset($_POST['longurl'])){
  
$longurl $_POST['longurl'];
  
header("location: http://www.smarturl.uni.cc/index.php?longurl=$longurl");
}else{

  echo 
'
  <form action="'
.$_SERVER['PHP_SELF'].'" method="post" target="_blank">
  <table><tr><td>
  Enter a long URL to make
  <a href="www.smarturl.uni.cc"> Smart URL:<br />
  <input type="text" name="longurl" size="30">
  <input type="submit" name="submit" value="Make Smart URL!">
  </td></tr></table>
  </form>'
;
}
?>


Best Regards/Allen Chen
Joomla, phpbb, WordPress, Opencart Installs
Reply With Quote
(#5)
Old
M.Qayyum M.Qayyum is offline
Senior Member
M.Qayyum is on a distinguished road
 
Posts: 125
Join Date: Jul 2009
Location: Pakistan
Default 11-30-2009, 02:07 PM

I can't figure it out.....


My latest website: http://www.sourcecodes.uni.cc

Last edited by M.Qayyum; 11-30-2009 at 02:18 PM. Reason: Submited wrong reply...
Reply With Quote
(#6)
Old
bigal's Avatar
bigal bigal is offline
Senior Member
bigal is on a distinguished road
 
Posts: 196
Join Date: Mar 2009
Location: Brisbane, Australia
Default 12-01-2009, 01:46 AM

Isn't this what you want?
Load it onto your test web server and see the outcome.


Best Regards/Allen Chen
Joomla, phpbb, WordPress, Opencart Installs
Reply With Quote
(#7)
Old
M.Qayyum M.Qayyum is offline
Senior Member
M.Qayyum is on a distinguished road
 
Posts: 125
Join Date: Jul 2009
Location: Pakistan
Default 12-01-2009, 12:22 PM

Thanks all of you to help me......i have done it

http://www.smarturl.uni.cc/add.php?l.../wiki/Pakistan


My latest website: http://www.sourcecodes.uni.cc
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com