Append Data on post

Hi,
I am very new to PHP.

I am trying to modify http://www.freephpdirectoryscript.com/ to do what I want.

What I want, is when the user types in the URL and hit submits, it appends something at the beginning of the URL.
Example, this is not what I want, but it will demonstrated. Pretend the URL the user enters is:
http://phphelp.com”.
I want the script to save it in the database as:
http://www.google.com/search?q=http://phphelp.com

Here is the code from the submit section of the script:

[code]

Type the new page data:

Url
Title (5-100 characters)
Description (0-200 characters)
Keywords (0-200 characters)
[/code]

I do not know if it should be done there, or somewhere else? As it would be nice to not have to do anything to the MySQL database, and just have it send the correct information.

The user has to submit the form before you can process it in PHP. Don’t try to do anything in the VALUE tag of the input field. You can do it with javascript before the form is submitted if you want. Either way would work.

To do it in PHP when the form is submitted this is what you do…

The form:

<P>Type the new page data:<P>
<FORM METHOD="post" ACTION="admin_edit_page_add.php">
Enter Url:&nbsp;<INPUT TYPE="text" NAME="url" MAXLENGTH=300><BR />
</FORM>

Then in admin_edit_page_add.php do this…

// this appends text using the dot character
$url = "http://www.google.com/search?q=" . $_POST['url'];
// now do your database update with $url
Sponsor our Newsletter | Privacy Policy | Terms of Service