Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to post a submit redirection

Status
Not open for further replies.

timgerr

IS-IT--Management
Jan 22, 2004
364
US
I want to send data to another page but I do now want to use a submit button. Here is what I am talking about. I have a page that I enter information then I have to hit the submit button. I want to redirect to a page with all the information located within the URL and automatically submit that information from the new page. I do not want to have to bring up the page, I want the information automatically submitted.

Is this possible?

Thanks,
Timgerr


-How important does a person have to be before they are considered assissinated instead of just murdered?

 
At the bottom of the page you want to automatically submit, use:

<script tyep="text/javascript">
document.forms['yourformnamehere'].submit();
</script>

Lee
 
is the page being redirected to needing to receive the information as a POST or with the variables in the URL?

If the later is true, then:

Code:
$query = "";
foreach ($_POST AS $postvar => $val) {
   $request .= (($request == "") ? "?" : "&").$postvar."=".urlencode($val);
}
header("Location: [URL unfurl="true"]http://www.mynewlocation.com/whatever".$query);[/URL]
exit;

The above will convert a POST submit (from your form) into a GET request as a header redirect statement.

If you need to POST to the new redirected location, you need to open up sockets and simulate a POST event. This is quite a bit more complicated to do, please post back here if this is what you require.
 
I have a form that I need to submit Here is the form.
Code:
<FORM NAME="QUESTION" Method="post" action="[URL unfurl="true"]http://XXX.Xot.com/Submit/SubmitMain.asp?category=1&location=MI06&tickettype=649&CoreID=TXXXX&Organization=">[/URL]

	<INPUT TYPE="HIDDEN" Name="CoreDirCorrect" Value="1">
	<INPUT TYPE="HIDDEN" Name="CustomerCoreID" value="TXXXX" maxlength="8">
	<INPUT TYPE=HIDDEN Name="PhoneNumber" Value="">
	<INPUT TYPE=HIDDEN Name="EmailCopiesTo" value="">
	
	<INPUT TYPE=HIDDEN Name="800014118" size="1" value="0">

    
   <INPUT TYPE=HIDDEN Name="Severity" size="1" value="3">
   
   <INPUT TYPE=HIDDEN Name="CustomerImpact" size="1" value="3">
  
    <INPUT TYPE=HIDDEN Name="Subject1"  value="Working on web server with remedy">
	<INPUT TYPE=HIDDEN Name="SubjectUsed" Value=1>
    
    
    <INPUT TYPE=HIDDEN Name="InitialDescription" value = "Send to MI06 Server Group">
    
    <INPUT TYPE=HIDDEN Name="7625" size="40" value="1">
    <INPUT TYPE=HIDDEN Name="7626" size="40" value="1">
</FORM>
I want to send this information directly to the web server and not have to open a web page. Can this be done?
Thanks

-How important does a person have to be before they are considered assissinated instead of just murdered?
 
Well now i'm way more confused than i originally was. *WHERE* is this form? Is it located in some HTML on your server? Please be much more specific about what you are trying to accomplish, from start to end.
 
OK, I am sorry for the confusion. This is a form on a webpage that I want to send data too. It is for a ticketing system that we need to use here at work. I now have to account for everything that I do using this system. What I have sent is all the field that need to be filled in thensubmitted to the
Code:
action="[URL unfurl="true"]http://XXX.Xot.com/Submit/SubmitMain.asp?category=1&location=MI06&tickettype=649&CoreID=TXXXX&Organization=">[/URL]
I sometime have to enter 15 to 20 tickets at a time and it is a drag. I found the informtion that the fileds need and hard coded them. I just need to change the
Code:
<INPUT TYPE=HIDDEN Name="Subject1"  value="Working on web server with remedy">
    <INPUT TYPE=HIDDEN Name="SubjectUsed" Value=1>
    
    
    <INPUT TYPE=HIDDEN Name="InitialDescription" value = "Send to MI06 Server Group">

I created a page that filles in this information to send to the asp page using php. I can hit the submit button 15 times or somehow automat (with my own form) and send the page 15 times. I know that this might be confusing to you that is because it is easer to say what I am trying to do.

-How important does a person have to be before they are considered assissinated instead of just murdered?
 
so, let me re-phrase to make sure i understand... you are going to have a form on your site which has boxes for 15 - 20 tickets, but ONLY that data which differs from one ticket to the next? Then, you want to submit all that data to a single php script, and have IT post 15 different times, including the standard non-changing information with what you filled in per ticket, to the actual ticketing server?

Do I have the gist of this right?
 
well sort of, you get the jist of it. If you look at the code you will see that the post is really a asp page
Code:
action="[URL unfurl="true"]http://XXX.Xot.com/Submit/SubmitMain.asp?category=1&location=MI06&tickettype=649&CoreID=TXXXX&Organization=">[/URL]
but the rest is corect.

-How important does a person have to be before they are considered assissinated instead of just murdered?
 
Well... POST'ing to another website 15 times from your PHP script is doable but a bit tedious code wise. If you can simply do GET statements (meaning, put all your info in the ?a=b&c=d format on the end of the URL), then it will be signficantly easier...

Each "GET" to your ticketing server would look something like:

Code:
// do this stuff only once, to grab the standard post variables if you need to from the request.
$query = "";
foreach ($_POST AS $postvar => $val) {
   $query .= (($request == "") ? "?" : "&").$postvar."=".urlencode($val);
}

$fp = fsockopen("[URL unfurl="true"]www.yourserver.com",80);[/URL]

// do the rest different each time for each "ticket" submit
// put in your ticket-specific variables here:
$query .= "&a=b&c=d"; // etc etc

$request = "GET /SubmitMain.asp".$query." HTTP/1.1\r\nHost: [URL unfurl="true"]www.yourserver.com\r\nConnection:[/URL] Close\r\n\r\n";
fwrite($fp, $request);

If you have to POST to that ASP script, then it will work kinda the same way but you have to formulate your request slightly differently ("POST" vs "GET", and your POST variables have to be formatted differently, etc). Hope this gets you on the right track.
 
I was thinking of doing somthing like that but I have to use a post.

Timgerr

-How important does a person have to be before they are considered assissinated instead of just murdered?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top