Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Please build this string for me, easy 500 points.

Posted on 2004-03-30
10
Medium Priority
?
191 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 1400 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 600 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

916 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