Solved

Please build this string for me, easy 500 points.

Posted on 2004-03-30
10
182 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
advertisement module in core php 4 88
Button Click 11 25
resizeing PHP image 2 22
php image upload 3 27
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

706 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now