Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Please build this string for me, easy 500 points.

Posted on 2004-03-30
10
Medium Priority
?
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
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.
Suggested Courses

730 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