I'm trying to allow users to add custom fields from the front end through a form. I know i'm on the right track but it just isnt working. If someone could help me get this working I'd be grateful. Here's my code: <form name="input" action="" method="get"> Mirror link: <input type="text" name="mirror"> <input type="submit" value="Submit" /> </form> <?php $link = $_GET['mirror']; if (substr($link, 0, 29) == "http://www.novamov.com/video/"){ $novamov = $link; add_post_meta($post_id, 'novamov', $novamov); } if (substr($link, 0, 26) == "http://videozer.com/video/") { $videozer = $link; add_post_meta($post_id, 'videozer', $videozer); } else { echo "Sorry we do not accept this host."; } ?> PHP:
A user enters a video url, if it is videozer or novamov then it accepts it and creates a custom field storing those links. If it is not the specified video hosts it echo's "Sorry we do not accept this host.". Well that is what is supposed to do any ways. Is there anyone that can help me with this? Please...
....my previous post explains exactly what it is doing. However, I shall give an example: http://bestanimes.tv/working-2-episode-11/ When the link is submitted it is not saved as a custom field. That is my problem. I am not trying to output the custom field yet, just want to store it.
Looks fine to me, if nothing is being added to the database you need to investigate the function add_post_meta(); and see if it's the correct one you should be using.
the only problem i can see is when a novamov.com link is added, the first if condition satisfies. then it checks whether the second if is true or not which isn't, obviously. and hence the else part executes and "sorry we do not accept" is printed. if this is the problem then changing second if to else if would be the solution.
Tried else if. That is not the problem here. The problem is that the custom field isn't being added. I'll pay 10$ to who ever can get this working.
hi pm me if you still need help...this is so simple...i dont want to post the solution here..all leechers will copy it