Solved

Please build this string for me, easy 500 points.

Posted on 2004-03-30
10
184 Views
Last Modified: 2008-03-06

I'm not a PHP programmer but I need a string built for me ASAP.

What I want to do in the PHP page is call a new website with a list of parameters.

In ASP it would look like this:

Dim strName
Dim strID
Dim strSite
Dim strWebSite

strWebSite = "http:\\www.mysite.com?Site=" + strSite + "&Name=" + strName + "&ID=" + strID
Response.Redirect(strWebSite)
Response.End

I'm looking at the PHP page now and there variables in the form already pre-filled. For example I have:

<?echo $_SESSION["faxNumber"]?>
which looks like a session variable and
<?echo $bankInfoArray[1]?>
which is an internal variable.

Lets say I need to build the above ASP script using "faxnumber" and bankinfoarra[1] in it in PHP and call another page.
0
Comment
Question by:bfeddish
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 14

Accepted Solution

by:
ThG earned 350 total points
ID: 10715606
this is definitely not the place where to ask this kind of question but.. only for this time ok?

$strName = "..";
$strID = "...";
$strSite = "xxx";

$strWebSite = "http://www.mysite.com?Site=" . $strSite . "&Name=" . $strName . "&ID=" . $strID;
header("Location: $strWebSite");
exit();
0
 
LVL 1

Author Comment

by:bfeddish
ID: 10715684

Why is this the wrong forum?
0
 
LVL 5

Expert Comment

by:crazycomputers
ID: 10716851
ThG, this is the correct forum.  He's asking for PHP code; it goes in the PHP forum.
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 14

Expert Comment

by:ThG
ID: 10717759
Let me explain better. I was a little sarcastic, because actually forums are never the right place to ask such things. Here is where you can find help learning/testing/debugging your PHP scripts.

This is not the place where you can hire people for doing your job, neither for money (explicitly against Member Agreement) nor for Experts points.

Let's say that bfeddish said "I'm just starting out learning PHP, can you tell me how to build this string like in ASP?"
0
 
LVL 1

Assisted Solution

by:Snow-Storm
Snow-Storm earned 150 total points
ID: 10720262
From your question, are you looking to get it from a form? Or just input the values yourself in the php code and have it redirect to that page?  If its out of a form you would do:
$strName = "$_REQUEST['inputName']";
$strID = "$_REQUEST['inputName']";
$strSite = "$_REQUEST['inputSite']";

$strWebSite = "http://www.mysite.com?Site=" . $strSite . "&Name=" . $strName . "&ID=" . $strID;
header("Location: $strWebSite");
exit();

P.S. If you are using more code before this, use ob_start at the beginning of your code and then use ob_end_flush after the header("Location line,  otherwise you will get unable to modify headers because they were already sent by your first bit of code.  This will put it into a buffer and send it when it reaches the ob_end_flush function.
0
 
LVL 5

Expert Comment

by:crazycomputers
ID: 10720398
FYI, you can do that without the extra quotes:

$strWebSite = "http://www.mysite.com?Site=$_REQUEST[inputSite]&Name=$_REQUEST[inputName]&ID=$_REQUEST[inputID]";
header("Location: $strWebSite");
0
 
LVL 1

Author Comment

by:bfeddish
ID: 10720489

From Snow-Storm:

>> From your question, are you looking to get it from a form? Or just input the values yourself in the php code and have it redirect to that page?  If its out of a form you would do: <<

Both, so actually you answered part of my question.

>> If you are using more code before this, use ob_start at the beginning of your code and then use ob_end_flush after the header <<

Thanks, I needed that too.

From THG
>> Let me explain better. I was a little sarcastic, because actually forums are never the right place to ask such things. Here is where you can find help learning/testing/debugging your PHP scripts. <<

What are you talking about???  I asked a question, one of the options is to offer 500 points for difficult or urgent. Who am I trying to buy here?  I had a simple question that I assumed a PHP programmer could answer in 20 seconds. I could anwer this in ASP in no time. I did not realize the PHP forum was so hostile.
0
 
LVL 1

Expert Comment

by:Snow-Storm
ID: 10720631
Oops i wasnt paying attention, it should actually be what crazy computers did or
$strName = "".$_REQUEST['inputName']."";
$strID = "".$_REQUEST['inputName']."";
$strSite = "".$_REQUEST['inputSite']."";

$strWebSite = "http://www.mysite.com?Site=" . $strSite . "&Name=" . $strName . "&ID=" . $strID;
header("Location: $strWebSite");
exit();
0
 
LVL 5

Expert Comment

by:crazycomputers
ID: 10720648
What's wrong with this?

$strName = $_REQUEST['inputName'];
0
 
LVL 14

Expert Comment

by:ThG
ID: 10728683
> I did not realize the PHP forum was so hostile.

It's not a matter of being hostile. I just told you that, I've been here for enough to say that often people come here asking experts to do their job ("i need a script that does ...", "please convert this to php.."), and it's not the purpose of this (or anyone else that I know of) forum.

ANYWAY--your question is quite easy so never mind, you don't fall in the above category. I hope this clears my point..
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question