have problems understanding the logic of using variables inside this code. why ist it possible to use %s for different variables and how is it possible to use them as %1$s and %2$s...without even defining them somewhere...i just dont get it, the complete code can be viewed in the thread: hyperlink from url
could anybody help:

$hyperlink = sprintf('<a href="http://%1$s" target="%2$s">%3$s</a>', $url, $target, $showingtext);

// Build the SQL query. This function will again replace each placeholder with the listed variable values respectively
$sql = sprintf("INSERT INTO `hyperlinktable2` SET `url` = '%s', `target` = '%s', `showingtext` = '%s', `hyperlink` = '%s'",
$url, $target, $showingtext, $hyperlink);

here is the form code to the variables
<form action="insert.php" method="post">
url: <input type="text" name="url" />
target: <input type="text" name="target" />
showingtext: <input type="text" name="showingtext" />

Edited by johng123: n/a

6 Years
Discussion Span
Last Post by vibhaJ
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.