422
422

Reputation: 5770

add php var within url parameter

Current URL is

<?php include ("/home/domain/public_html/create/dogs.php"); ?>

I want to do this:

<?php include ("/home/domain/public_html/create/<?php $partURL; ?>s.php"); ?>

$partURL is predefined. Just need to parse the php include within the above URL to parse correctly

Upvotes: 2

Views: 111

Answers (3)

Arjun Bajaj
Arjun Bajaj

Reputation: 1962

You have to remove the PHP Tags from the "part URL" cause you are already in PHP.

<?php include ("/home/domain/public_html/create/" . $partURL . "s.php"); ?>

Upvotes: 1

Aaron W.
Aaron W.

Reputation: 9299

Read up on strings in PHP.

<?php include ("/home/domain/public_html/create/".$partURL."s.php"); ?>

Upvotes: 1

Muhit
Muhit

Reputation: 789

You can do like this

 <?php include ("/home/domain/public_html/create/{$partURL}s.php"); ?>

You can not use php tag with in a php tag like <?php <?php ?>?>

Upvotes: 2

Related Questions