Solved

Please build this string for me, easy 500 points.

Posted on 2004-03-30
10
183 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

919 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

20 Experts available now in Live!

Get 1:1 Help Now